繁体   English   中英

基本 .htaccess mod_rewrite 帮助

[英]Help with basic .htaccess mod_rewrite

I am currently interpreting sub-domain wild-cards with php and i would like to handle them with .htaccess, user profiles will be accessed at http://username.mysite.com/ (or for some people http://www.username .mysite.com/ )应该使用 /main.php?action=profile

最难的部分是制作 /error/i+am+a+test+message 或 /files/iamatestfile.jpg go 到 &error=i+am+a+test+message 或 &files=iamatestfile.jpg

感谢您的任何帮助!

尝试:

 RewriteRule ^error/(.*) index.php?error=$1 [L]
 RewriteRule ^file/(.*) index.php?file=$1 [L]

...对于最后两个。

尝试这个:

# stop rewriting for the host names example.com and www.example.com
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule ^ - [L]

RewriteRule ^error/(.*) index.php?error=$1 [L]
RewriteRule ^file/(.*) index.php?file=$1 [L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM