帮助基本.htaccess mod_rewrite

时间:2009-03-08 06:31:41

标签: php apache .htaccess

我目前正在使用php解释子域通配符,我想用.htaccess处理它们,用户配置文件将在http://username.mysite.com/(或某些人http://www.username.mysite.com/)访问,这应该是使用/main.php?action=profile

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

感谢您的帮助!

2 个答案:

答案 0 :(得分:2)

尝试:

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

......最后两个。

答案 1 :(得分:0)

试试这个:

# 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]