Here is my entire .htaccess:
RewriteEngine On
RewriteBase /~user/sitetest/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)/?$ view.php?id=$1
When I access http://localhost/~user/sitetest/abc123, it loads the $_GET[“id”] value and everything works fine. It’s brilliant!
But I wanted it to work at http://localhost/~user/sitetest/view/abc123 (notice “view/”)
So I tried replacing the RewriteRule with:
RewriteRule ^view/(.+?)/?$ view.php?id=$1
But to no avail! It doesn’t seem to load the $_GET[] from view.php. I even tried echoing out the $_GET[] value but it shows up as blank when I access http://localhost/~user/sitetest/view/abc123
So I edited it to see if this would work:
RewriteRule ^view-(.+?)/?$ view.php?id=$1
And it does when I access http://localhost/~user/sitetest/view-abc123 (notice the “-” instead of a “/”)
So does it have something to do with the slash?? I am lost and have been struggling to figure this out.
EDIT:
I’m still having problems, but I noticed when I tried:
RewriteRule ^test/(.+)/?$ view.php?id=$1
And accessed http://localhost/~user/sitetest/test/abc123 it worked!
So there seems to be a conflict with “view.php” and “view/” .. so in the worst case I’ll rename view.php. But I’d still like to figure out what exactly is going wrong.
viewin the requested url clashes with theview.phpfile, if MultiViews is enabled.Disabled it with
Options -MultiViewsin your htaccess.