0
votes

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

  • / => homepage
  • /abc => /index.php?x=abc
  • /abc/def => /index.php?x=abc&y=def
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?

1
Raise log level for mode rewrite and see logs, it can help you a lot, at least post it.Ency
@Ency: “mod” is the abbreviation for module.Gumbo

1 Answers

0
votes

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