ReWrite Engine无效,我正在使用 000Webhost 作为我的虚拟主机服务提供商,我正在免费计划。
问题:
1.)当我进入我的域(没有子域名),如 prospekt.ml 时,我将被重定向到000Webhost 404错误。
2。)当我尝试测试我的.htaccess时它是否正常工作。它应该重写网址并添加虚荣网址。喜欢( user / astroXoom)但不是那样,我被重定向到000Webhost 404错误。
.htaccess 文件放在我的public_html文件夹中。它应该重定向到“member / user / username.php?username = $ 1”
谢谢你,祝你有个美好的一天!
编辑:
这是我的 .htaccess文件
# Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /
# Fancy Indexing
Options Indexes
IndexOptions FancyIndexing NameWidth=80 ScanHTMLTitles
IndexOrderDefault Ascending Date
IndexIgnore *.jpg *.png
# Rewrite for Users
RewriteEngine on
RewriteRule ^member/user/([^/]+)$ member/user/username.php?username=$1 [L,QSA]
答案 0 :(得分:1)
在000webhost服务器上,您必须使用绝对重写路径(以/开头)或RewriteBase指令将重写的URL映射到正确的位置,因为000webhost服务器使用虚拟用户主目录,因此在您使用时添加RewriteBase指令非常重要在Rewrite target中使用相对路径,否则将找不到404。
来源: