Reputation: 13
This is my htaccess file
RewriteEngine on
rewriterule ^([a-zA-Z0-9]+) /vixer.php?v=$1 [QSA]
the main problem is that when I enter www.example.com/vix_25 it goes to 404
and when I enter another url /vix25 it works.. I really dont understand what is the diffrence and why 1st doesnt work.
Can you guys help me? thanks
Upvotes: 1
Views: 23
Reputation: 24448
I would make it a bit more robust for your rule. Tell apache that if it's not a real file and not a real directory then rewrite it. This prevents 404's too. I also changed the regex so that it will match better instead of individually adding matches. Also I would make sure MultiViews are off.
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
rewriterule ^([^/]+)/?$ /vixer.php?v=$1 [QSA,L]
Upvotes: 1
Reputation: 41219
You need to add an underscore to the pattern so that it can match a "_" in the Requested URI
([a-zA-Z0-9_]+)
Try this :
RewriteEngine on
rewriterule ^([a-zA-Z0-9_]+)$ /vixer.php?v=$1 [QSA,L]
Upvotes: 2