繁体   English   中英

内部服务器错误:.htaccess中的mod_rewrite遇到问题

[英]Internal Server Error: Having trouble with mod_rewrite in .htaccess

我的网址是这样的:

http://example.com/Folder/index.php?city=Berlin&id=1

我想把它变成:

http://example.com/Berlin/1

使用生成它! 我得到以下代码:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /Folder/index.php?city=$1&id=$2 [L]

但是,当在我的.htaccess文件中添加此文件并尝试打开http://example.com/Berlin/1 ,出现以下错误:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] 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.

Apache/2.2.14 (Ubuntu) Server at example.com Port 80

我究竟做错了什么? 因为小时我试图得到它的工作,但都没有成功。

我找到了解决方案:

我在我的.htaccess使用它:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/id/([^/]*)$ /Folder/index.php?city=$1&title=$2&id=$3 [L]

更改此链接:

http://example.com/Folder/index.php?id=566&city=Berlin&title=this_is_the_websites_title

至:

http://example.com/Berlin/this_is_the_websites_title/id/566

暂无
暂无

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

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