Articles of .htaccess

重写debian中的redirect问题

我的服务器操作系统是debian挤压。 我有这些行来redirect非www到我的网站的htaccess文件中的www: RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 但在Firefox中导致这个错误: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies. 当我评论这些行在htaccess mysite出现,但在非www格式。 我确定它在Ubuntu上运行良好。 但我不知道为什么现在不行。 你能帮我吗?

.htaccess将所有查询重写为静态页面

我有一个帐户,有数百个入站链接到他们的日历显示为404(他们把他们的网站移动到一个新的平台)。 我想做一个通配符的查询所有的URL到他们的旧事件日历登陆一个新的静态页面,并为他们的网上商店查询做同样的事情。 我已经尝试了几个变化,但似乎无法得到它的工作。 案例1:我需要redirect这样的url(请注意“showDay”和“showWeek”之间的区别): calid = 5107976&year = 2011&month = 7&day = 10 apps / calendar / showDay?calID = 5107976&year = 2011&month = 9&day = 10 至: http://domain.com/events/ 情况2:还有这样的url: 应用/networking商店/产品/显示/ 1927074 TO: http : //subdomain.domain.com/ 我似乎无法得到所有的URLS和redirect他们的语法正确。 我正在寻找一个像“apps / calendar / *”通配符在命令行中的通配符。 任何帮助表示赞赏!

registry达式htaccess重写规则

我是新的使用正则expression式重写URL的htaccess中 我需要将mysite.com/123redirect到mysite.com/,如果cookie设置为'ref'。 我目前的htaccess是: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_COOKIE} ref=true [NC] RewriteRule ^/([0-9]+)/$ http://www.mysite.com </IfModule> 目标是,当有人进入网站:mysite.com/111(一些数字),他们被redirect到该网站的主页后,cookie被设置。

nGinx非www到wwwredirect

我一直在使用Apache多年,现在想移动到nGinx保持在互联网上每个人似乎都在谈论的performance。 但是,我非常沮丧,因为我无法重写一个非www的url到www,即example.com到www.example.com 我已经提到了StackOverflow的所有post,并尝试过他们的configuration。 不知何故系统似乎不工作。 我浪费了2个多小时,需要你的帮助。 我的nGinx版本是1.2.1 。 这是在阿帕奇15秒的工作。 我不知何故开始失踪阿帕奇。

.htaccess将域中的所有页面redirect到同一个域中除root,/index.html,/index.php

我已经search并尝试了我find的一切,似乎没有什么工作是正确的。 我想要做的是: 将所有页面从域(domain.com)redirect到同一个域内的一个目录(domain.com/dir或domain.com/dir/index.php); 不过,我不想redirect: domain.com/index.php; domain.com; www.domain.com 显然,所有页面将redirect到的目录(domain.com/dir)。 我想用.htaccess来做这个,因为它似乎是最明显的select – 我只是不太熟悉.htaccess脚本,因为我想成为。 任何帮助将非常感激。 非常感谢!

使用URL参数时,redirect指令在.htaccess中被忽略

我有一个drupal附带的默认.htaccess文件。 为了将旧网站的外部链接页面redirect到新网页,我通常使用类似的语句 Redirect /foo http://www.example.com/bar 这按预期工作。 但是看起来这个陈述完全被忽略了 Redirect /index.php?x=y http://www.example.com 并且该请求在.htaccess文件的末尾通过Drupal中的mod_rewrite规则运行。 你知道什么是问题吗?

跟踪一个奇怪的Apache重写

tl:dr; 你将如何去跟踪一个URL不应该发生重写? 细节:我有一个.htaccess文件,它很简单: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ – [NC,L] RewriteRule ^.*$ /index.php [NC,L] 重写已启用。 当我访问如下的url: foo.com/index.php我得到了我所期望的。 但是foo.com/index/会redirect到foo.com/index.htm 所以在我的应用程序路线,如foo.com/index/books/fiction将成为foo.com/index.htm/books/fiction 哪里可以设置? 我以为它可能在我的虚拟主机文件,但看起来像: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow […]

redirect404错误,而不重写URL

是否有可能有一个错误的url留在地址栏中,同时将用户redirect到我的域中的URL? 我希望www.domain.com/forum是在所有404个情况下服务的实际网站,但我不希望引用url被重写(域名部分除外,这是在注册服务商级别完成的)。 这是我当前的.htaccess RewriteEngine On RedirectMatch permanent ^/$ http://www.domain.com/forum/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* http://www.domain.com/forum/ [L,R]

将在目录中找不到的所有内容redirect到另一个导演

我有名为v1和v2的目录。 因此,用户可以访问http://example.com/v1或http://example.com/v2 。 v2有一个来自v1的index.html副本,以及一些从不在v1的css文件。 v1有一个包含数百个图像的图像目录。 如果用户转到v2 / images,他们正确地得到了404。我如何将v2目录中找不到的任何内容redirect到v1目录? 例如: http://example.com/v2/someotherfile.html -> http://example.com/v1/someotherfile.html http://example.com/v2/images/base.jpg -> http://example.com/v1/images/base.jpg http://example.com/v2/index.html //does not redirect (如果它不存在于v1或v2中,它应该转到在.htaccess中定义的404的ErrorDocument?) 另外用户我的意思是任何东西,ajax img和脚本标签的src。

htaccessredirect将问号添加到url

我在我的htaccess中有以下几点: #When your application folder isn't in the system folder RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /?/$1 [L] #Checks to see if the user is attempting to access a valid file, RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ?/$1 [L] #No WWW RewriteCond %{HTTP_HOST} !^myrealdomain.com$ [NC] RewriteRule ^(.*)$ https://myrealdomain.com/$1 [L,R=301] #Always redirect to SSL pages […]