[英]change static url to dynamic with mod_rewrite
我需要更改以下内容:
www.mydomain.com/www.otherdomain.com
对此:
www.mydomain.com/index.php?co=www.otherdomain.com
使用mod_rewrite我想到了这个:
RewriteRule ^(.*.)+$ index.php?co=$1 [L]
但是,它仅返回co
参数的“ index.php”,而不像我希望的那样返回“ www.otherdomain.com”。
谢谢你的帮助!
尝试以下方法:
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteRule (.*) index.php?co=$1
RewriteCond检查所请求的路径是否尚未以“ /index.php”开头(如果不执行此检查,将发生无限循环)。 并且,如果没有,那么RewriteRule然后将请求中的所有内容重写到所需的index.php路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.