For example I want to change:
www.example.com/forum/thread?id=1&topic=hello
to
www.example.com/forum/thread/1/hello
I've looked around and modified my .htacess file to look like this to modify these URLs
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^thread/([0-9]+)/([0-9a-zA-Z_-]+) thread.php?id=$1&topic=$2 [NC,L]
I keep getting a 404 error saying that the file doesn't exist. I'm wondering if it's because I'm removing the .php from the file first using this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
But then when I remove that rule and go to thread.php?id=1&topic=hello it just breaks everything and gives me masses of errors
RewriteBase?RewriteRule ^([^\.]+)$ $1.php [NC,L]you are basically turningwww.example.com/forum/thread/1/hellointowww.example.com/forum/thread/1/hello.php, you need a better regexp to remove the ".php" from URL and have your arguments passed like you want