我一直在努力解决这个问题几个晚上没有运气。我试图用(.htaccess)是否 从重写Web请求:cobweb.seas.gwu.edu/~mpnl 到:cobweb.seas.gwu.edu/~mpnl/joomla(.htaccess)如何将mod_rewrite用户网站mod_rewrite同一网站内的子文件夹
我最近(的.htaccess )文件如下:
我一直在努力解决这个问题几个晚上没有运气。我试图用(.htaccess)是否 从重写Web请求:cobweb.seas.gwu.edu/~mpnl 到:cobweb.seas.gwu.edu/~mpnl/joomla(.htaccess)如何将mod_rewrite用户网站mod_rewrite同一网站内的子文件夹
我最近(的.htaccess )文件如下:
您无法与具有%{HTTP_HOST} var的URI路径进行匹配,只有主机。你要么需要包括~mpnl
部分作为重写碱或请求的一部分URI:
RewriteEngine on
# remove the "/~mpnl" from the end of this line, add a [NC]
RewriteCond %{HTTP_HOST} ^(www.)?cobweb.seas.gwu.edu$ [NC]
# add a "/~mpnl" to here
RewriteCond %{REQUEST_URI} !^/~mpnl/joomla/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# remove the leading slash before "joomla"
RewriteRule ^(.*)$ joomla/$1 [L]
# add a condition to this:
RewriteCond %{REQUEST_URI} !^/~mpnl/joomla/
RewriteRule ^(/)?$ joomla/index.php [L]
为rewrite在URI请求与UserDir
,你必须设置一个RewriteBase
:
RewriteBase /~mpnl/
我尝试了你的建议(.htaccess)文件没有成功 - 仍然得到相同的500内部服务器错误。我仔细检查并在服务器上启用了mod_rewrite。我使用textedit编辑文件,确保文件保存为unix和ansi编码。还尝试了各种权限。我应该提到我将(.htaccess)文件保存到public_html的根目录。 –