Articles of mod rewrite

(\ d +)和( +)htaccess重写不能在新的服务器上工作,在旧的服务器上正常工作

RewriteRule ^ mp3 /(\ d +)/(。*)/ $ download.php?id = $ 1 [L,NC] 是我正在努力工作的具体重写规则….它在我的旧服务器上工作正常,但现在我在与Apache 1.3.4.1的服务器上,如果这有什么关系。

Apache的mod_proxy URLredirect/别名

伙计们! 有一个Apache的mod_proxy问题,希望有人能帮助 前言:我们需要一个新的域( http://section1.info )来引导用户访问( http://domain.info/?q=section1 )并在URL中保留section1.info。 以下似乎不工作: ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://domain.info/?q=section1 ProxyPassReverse / http://domain.info/?q=section1 谢谢!

排除某些扩展名的url被redirect到索引页

我有一套重写规则,将所有不存在的页面redirect到我的网站的索引: RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ – [NC,L] RewriteRule ^.*$ index.php [NC,L] 目前的规则基本上是将每个不是目录或文件的URLredirect到index.php,所以www.example.com/thispagedoesntexist以及www.example.com/missingfile.xml转到index.php页面。 如果该URL不存在于CMS中,则会触发404错误返回给用户。 .(js|css|ico|gif|jpg|png|xml|html|swf|ttf|eot)$被redirect,即使文件没有存在。 我仍然希望继续将不存在的页面指向index.php,但是如果URL以任何这些文件扩展名结束,则不会。

301将所有内容 – domain.orgredirect到domain.com

尝试了几个解决scheme后,我似乎无法得到这个工作。 我拥有一个.org,并有urls喜欢 http://mydomain.org/view/3242343 http://mydomain.org/login http://mydomain.org/page/5 我现在有了.com,并希望所有这些都能被正确使用到它们的.com等价物上: http://mydomain.com/view/3242343 http://mydomain.com/login http://mydomain.com/page/5 等等 我迄今为止所尝试的规则似乎是从.org获取任何URL,并将其发送到mydomain.com的根目录。 我需要什么htaccess规则? 谢谢,

尝试访问example.com时,mod_rewriteredirect到www.example.com

我有一个VPS,我试图build立多个网站。 对于其中的一个,按照当前的一组规则(如下)访问 hxxp://example.com 送我去 hxxp://www.example.com// [note the two //] 我的httpd.conf看起来像: NameVirtualHost *:80 [other VirtualHosts] <VirtualHost *:80> ServerAlias www.example.com example.com DocumentRoot /var/www/html/example.com ServerName www.example.com RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$1 [R=301,L] <directory /var/www/html/example.com> Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^([0-9]+)(.*)/?$ /showitem.php?j=$1 [NC] </directory> </VirtualHost>

Apache子域redirect失败

我刚刚购买了域名vas.im ,为vas.im和www.vas.im添加了DNS规则,然后我试图让apache2将后者redirect到前者。 我启用了mod_rewrite,追加了/etc/apache2/httpd.conf ,并重新启动了apache2服务。 ServerName localhost AccessFileName .htaccess # Redirect www to non-www RewriteEngine On RewriteEngine On RewriteCond %{HTTP_HOST} ^[url]www.vas.im[/url] [NC] RewriteRule ^(.*)$ [vas.im…] [L,R=301] 我一定犯了一些错误,因为www域不redirect。 我不假装我理解mod_rewrite,所以我想知道是否有人知道这个问题是什么。

Apacheredirect到具有目录的外部站点

我有一些要求 blogs.bobvilapaint.com/11/11/2011/title 我想redirect到 staging.bobvila.com/blogs/title 我写了 RewriteRule ^ [0-9 /] + / [0-9] + / [0-9] + /(。*)$ http://staging.bobvila.com/blogs/$1 [R,L] 但不是被redirect到 staging.bobvila.com/blogs/title 它被redirect到 staging.bobvila.com/title 所以我不明白为什么redirect规则把它重新定向到新服务器上的“博客”目录。

如何使子目录成为Web域或本地主机的文档根目录

我在文件根目录/var/www/html有一个子目录abc 我希望能够通过在浏览器中input在子目录中运行任何文件any_file.html : localhost/any_file而不是localhost/abc/any_file.html或my_domain.com/any_file而不是my_domain.com/abc/any_file.html 我试图写在httpd.conf : <Directory "/var/www/html/abc"> RewriteEngine On RewriteBase / RewriteRule %{REQUEST_FILENAME} %{REQUEST_FILENAME}\.html </Directory> 但它不起作用。 Options FollowSymLinks在<Directory>激活,所以我相信我不需要再写这个。 有谁知道为什么以及如何解决它? 谢谢。 更新:我有另一个子目录efg ,我需要能够通过本地访问。

如何写一个mod_rewrite规则来确定域是不是主域然后改变https://到http://

我为example.com设置了一个带有通配符ssl的WordPress多站点,以安全地访问pipe理区域。 不过,我也使用域映射将其他域映射到其他网站,如alldogs.com到alldogs.example.com。 问题是,当我试图从一个映射域访问网站的前端和pipe理,例如alldogs.com通过点击“访问网站”链接去https://alldogs.com由于强制SSL应用到pipe理区域。 哪个产生证书警告,因为证书是example.com而不是alldogs.com。 如何编写mod_rewrite规则来确定点击的URL /链接是否不是主要的域,例如example.com,然后将https://更改为http://,以便可以通过端口80访问站点,而不生成证书警告该映射域

Apache模式重写太多的redirect

我试图redirect我的默认语言(nl)的所有请求到/ nl …..(不显示redirect到用户)。 因此,example.com应该redirect到example.com/nl,而不会明显地改变浏览器中的url。 这是我试过的: RewriteEngine On RewriteCond %{REQUEST_URI} !^/en.* RewriteCond %{REQUEST_URI} !^/nl.* RewriteRule ^(.*)$ nl$1 [R,L] 用户可以看到redirect(/nl/index.php),并且导致“redirect太多”。 如果我尝试[P,L],我得到:无权访问此服务器上的“\”。 什么是正确的方法来实现我想要的?