Forum Moderators: phranque
http://www.example.com/en/?url=http%3A%2F%2Fexample2.com%2Ftest%2F
On example.com/.htaccess I have:
RewriteRule ^(.{2})/(.*)$ /links/index.php$2&lang=$1
At exmaple.com/links/index.php I have a file.
For what ever reason I get a 404 error.
However, if I change my .taccess file to:
RewriteRule ^.{2}/(.*)$ /links/index.php$1
It works fine.
Why is this not working, and are there any fixes I should make to .htaccess file, It seems sickly.
Thanks
RewriteRule cannot "see" parameters. You need an additional RewriteCond for that.
If this is a rewrite, you'll need the [L] flag on the end of the rule.
If you're trying to implement some sort of "static-looking" URL system, then the links on your page need to use that new format too. It is the links that 'define' URLs.
If this is some sort of redirect system, then there are other code issues to also fix.
The .{2} notation is likely incorrect. You normally use {} after [] here.
The use of .* is brutally inefficient, and likely needs a different pattern. Without knowing what it is supposed to do, i can't suggest a replacement yet.
In any explanation take great care to use the exact words like "redirect" and "rewrite" in their correct manner to explain the issue.