Mbarry
Mbarry

Reputation: 251

htaccess rewrite rule doesn't work

in my .htaccess file i do have these lines:

Options +FollowSymLinks 
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule
^([a-zA-Z0-9_-]+)/([0-9])/([a-zA-Z0-9_-]+)\.(html)$ /first_gate/index.php?show=true&_=$1&__=$2 [QSA]

So calling:

http://www.domain.com/a-b-c-d/123/an-thing-here.html

in the background it's intended to be:

http://www.domain.com/first_gate/index.php?show=true&cat=a-b-c-d&sub_cat=123

The (an-thing-here) part wouldn't be used for retreiving data but just to improve SEO.

I got: 404 Not found.

Any help would be soooo much appreciated. Thank you,

Upvotes: 0

Views: 735

Answers (1)

nortron
nortron

Reputation: 3891

Your second pattern group is only matching a single digit, try this instead:

Options +FollowSymLinks 
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule
^([a-zA-Z0-9_-]+)/([0-9]+)/([a-zA-Z0-9_-]+)\.(html)$ /first_gate/index.php?show=true&_=$1&__=$2 [QSA]

I just added a + after the pattern [0-9].

Upvotes: 1

Related Questions