由网友(情義丶來生敘)分享简介:这是什么,我想实现的一个例子。原网址:http://subdomain.domain.com/company.php?test=TES001 重写的网址:http://subdomain.domain.com/company/AAA001 选项+了FollowSymLinksRewriteEngine叙述上的R...
这是什么,我想实现的一个例子。
原网址:
http://subdomain.domain.com/company.php?test=TES001
重写的网址:
http://subdomain.domain.com/company/AAA001
选项+了FollowSymLinks
RewriteEngine叙述上
的RewriteBase /
重写规则公司/(.*)/(.*)/$ /company.php?$1=$2
的ErrorDocument 404 /
解决方案
如果你想 /company.php?test=AAA001
来重定向到 /公司/ AAA001
,做到这一点:
的RewriteCond%{QUERY_STRING}测试=([AZ] + [0-9] +)
重写规则^ company.php /公司/%1? [R]
如果你想 /公司/ AAA001
来改写为 /company.php?test=AAA001
,做这样的:
重写规则的公司/([AZ] + [0-9] +)$ /company.php?test=$1
This is an example of what I am trying to achieve.
The original URL:
http://subdomain.domain.com/company.php?test=TES001
The rewritten URL:
http://subdomain.domain.com/company/AAA001
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule company/(.*)/(.*)/$ /company.php?$1=$2
ErrorDocument 404 /
解决方案
If you want /company.php?test=AAA001
to redirect to /company/AAA001
, do this:
RewriteCond %{QUERY_STRING} test=([A-Z]+[0-9]+)
RewriteRule ^company.php /company/%1? [R]
If you want /company/AAA001
to be rewritten as /company.php?test=AAA001
, do this:
RewriteRule company/([A-Z]+[0-9]+)$ /company.php?test=$1
相关推荐
最新文章