简体   繁体   English

URL重写不起作用-.htaccess中的重写规则

[英]URL Rewriting not working - rewrite rule in .htaccess

I have enabled the rewrite module in apache . 我已经在apache中启用了重写模块。 Later i developed the .htaccess file in root . 后来我在root用户中开发了.htaccess文件。

RewriteEngine On
RewriteRule ^test.html $ test.php

but its not working ? 但它不起作用? Internal server error occurs. 发生内部服务器错误。 What to do next? 接下来做什么?

I'd say mod_rewrite is not turned on, or it's not allowed in an .htaccess file. 我会说mod_rewrite没有打开,或者.htaccess文件中不允许。 Check the error log. 检查错误日志。

Your rule is also wrong, it should be 您的规则也是错误的,应该是

RewriteRule ^test\.html$ test.php

The dot means "any character" and should be escaped; 点表示“任何字符”,应转义; you also had a space after html . html后面也有一个空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM