Home > OS >  URL GET parameters to show as a directory
URL GET parameters to show as a directory

Time:11-13

I am attempting to have my GET parameters display in the url as a directory. So, mywebsite/?pix=5 would show as mywebsite/5. There are only numbers I have to look up. I have the following .htaccess code but im just getting a 404 Not Found. Any help would be appreciated.

Options  FollowSymLinks
RewriteEngine on

#don't use .php file extension
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]

#test get peram to directory
RewriteRule ^([0-9] )/$ /index.php?pix=$1

CodePudding user response:

Your code is almost ok. Try this:

RewriteRule ^([0-9] )$ index.php?pix=$1
  • Related