Mohamed Amin
Mohamed Amin

Reputation: 1067

url rewrite 404 - Not found

i tried this to rewrite url,and worked perfectly

Options +FollowSymLinks
RewriteEngine on
RewriteRule download-id-(.*)\.htm$ download.php?id=$1

but when i tried to rewrite download.php?id=xx to download.php/id/xx by the following:

Options +FollowSymLinks
RewriteEngine on
RewriteRule download/id/(.*)/ download.php?id=$1
RewriteRule download/id/(.*) download.php?id=$1

i got an 404 - Not found! error


what's the problem i used this good tool to generate the syntax http://www.webconfs.com/url-rewriting-tool.php

Upvotes: 0

Views: 515

Answers (1)

Liam Bailey
Liam Bailey

Reputation: 5905

You need to make it:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^download/id/([0-9]+)\/?$ download.php?id=$1

the /? means it can have a trailing slash or not, and the ^ and $ start and end the search string.

Upvotes: 2

Related Questions