【发布时间】:2014-05-10 21:05:07
【问题描述】:
对于域市场,我想重写一些 url 并将我的旧页面(在目录中)直接重定向到新页面。
对于“rewrite url”,我使用了这些代码:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(.*\.php)?$
RewriteCond %{REQUEST_URI} !^/(.*\.htm)?$
RewriteCond %{REQUEST_URI} !^/(.*\.html)?$
RewriteCond %{REQUEST_URI} !^/(.*\.shtml)?$
RewriteCond %{REQUEST_URI} !^/whois/$
RewriteRule ^(.*\.*)$ /details.php?domain=$1 [qsa,l]
RewriteRule ^whois/([^/]*)$ /whoisrequest/whois.php?whois=$1 [L]
例如http://mydomain.com/test.com url 重写为http://mydomain.com/details.php?domain=test.com- 没关系。
问题:但同时,对于重写whois url (http://mydomain.com/whois/test.com) 或将旧页面(如http://mydomain.com/domains/123/test.com)重定向到新页面(如http://mydomain.com/test.com)重写为@987654327 @
我应该如何处理这些规则:
如果
http://mydomain.com/test.com,则重写http://mydomain.com/details.php?domain=test.com(仅在主站点上并包括“.”[点] - 它可以是任何东西。任何东西)如果
http://mydomain.com/folder1/或更多文件夹,则“. (点)不重要',不会重写。此外,将 301
http://mydomain.com/domains/123/test.com重定向到http://mydomain.com/test.com
【问题讨论】:
-
我认为
RewriteCond只会在第一个RewriteRule中使用。为每个RewriteRule添加这些 -
感谢您的帮助。我将编辑我的文件。
标签: php regex apache .htaccess mod-rewrite