【发布时间】:2009-11-26 23:40:01
【问题描述】:
我将在 .htaccess 中使用什么来代替 Document_Root??
以下是在我的 linux 服务器的 htttp.conf 中。
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.php -f
RewriteRule ^/(.*)(/?)$ /$1.php [L]
RewriteRule ^/([a-zA-Z]+)([a-zA-Z0-9_]{3,15})(/?)$ /profile.php?fairid=$1$2 [L]
RewriteRule ^/([a-zA-Z]+)([a-zA-Z0-9_]{3,15})/([a-z]*)(/?)$ /$3.php?fairid=$1$2 [L]
但现在我将域转移到共享服务器。那么为了正确运行我的网站,在重写规则中需要对 .htaccess 进行哪些更改?
我的.htaccess如下:
RewriteEngine On
RewriteBase /~laborfa2
RewriteCond %/~laborfa2/lf/main/com/%{REQUEST_FILENAME}.php -f
RewriteRule /(.*)(/?)$ /~laborfa2/lf/main/com/$1.php [L]
RewriteRule ^/([a-zA-Z]+)([a-zA-Z0-9_]{3,15})(/?)$ /~laborfa2/lf/main/com/profile.php?fairid=$1$2 [L]
但它不起作用。请建议在 .htaccess 中需要进行更改。
【问题讨论】:
标签: .htaccess mod-rewrite