简体   繁体   中英

Basic URL Rewriting causing internal server error

I'm very new to this and have read a couple of articles on URL rewriting.

http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

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

To www.domain.com/recipes/6

From the tutorials I have come up with the following code in my .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.

Any help would be appreciated.

我认为是因为有多余的空间,请删除并尝试:

RewriteRule ^recipes/([0-9]+)/?$ single-recipe.php?id=$1[NC,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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