[英]Basic URL Rewriting causing internal server error
I'm very new to this and have read a couple of articles on URL rewriting. 我对此很陌生,已经阅读了几篇有关URL重写的文章。
http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/ http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/
http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/ http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/
All i want to do is change www.domain.com/single-recipe.php?id=6 我要做的就是更改www.domain.com/single-recipe.php?id=6
To www.domain.com/recipes/6 前往www.domain.com/recipes/6
From the tutorials I have come up with the following code in my .htaccess 从教程中,我在.htaccess中提出了以下代码
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
RewriteRule ^recipes/([0-9]+)/?$ single-recipe.php?id=$1 [NC,L] # Handle recipe requests
When i try to access any page on the site i am greeted with a lovely internal server error 500. 当我尝试访问网站上的任何页面时,都会看到一个可爱的内部服务器错误500。
Any help would be appreciated. 任何帮助,将不胜感激。
我认为是因为有多余的空间,请删除并尝试:
RewriteRule ^recipes/([0-9]+)/?$ single-recipe.php?id=$1[NC,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.