SPRBRN
SPRBRN

Reputation: 2462

htaccess rewriterule help needed

I'm trying to get some rewriterules working. Htaccess is enabled, the mod-rewrite loads. It should work as follows:

RewriteEngine On
RewriteBase /
RewriteRule /           /index.php
RewriteRule /([a-z]+)       /index.php?x=$1
RewriteRule /([a-z]+)/([a-z]+)  /index.php?x=$1&y=$2

If I try this, the homepage works, but the rest results in a 404 error. What is wrong here?

Upvotes: 0

Views: 1614

Answers (1)

Gumbo
Gumbo

Reputation: 655785

You need to omit the contextual path prefix and should limit the pattern:

RewriteRule ^$           /index.php
RewriteRule ^([a-z]+)$       /index.php?x=$1
RewriteRule ^([a-z]+)/([a-z]+)$  /index.php?x=$1&y=$2

Upvotes: 0

Related Questions