我的DocumentRoot
网络服务器上具有以下结构:
folder1
folder2
我可以以标准方式访问所有这些
my.ip.address.here/folder1
my.ip.address.here/folder2
我想将请求重定向到未将特定文件夹指定为一个默认文件夹(即“ folder1”)的网站。例如,如果我输入一个浏览器my.ip.address.here
,它将把我重定向到“ my.ip.address.here/folder1”。我的文件DocumentRoot
夹内有.htaccess文件,其中包含以下内容:
RewriteEngine On
RewriteRule ^$ /folder1 [R=301, L]
当我在浏览器中运行网站时,出现以下错误:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
配置可能出什么问题?提前致谢!
如果您只是想在内部重定向或不重定向/
到folder2
这些规则中的任何一个,都可以。
使用规则重定向301:
RewriteRule ^$ /folder2 [R=301,L]
在内部,URL不会更改:
RewriteRule ^$ /folder2 [L]
如果您要进行临时重定向,请使用302;对于永久重定向,请使用301。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句