Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

URL GET parameters to show as a directory

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Your code is almost ok. Try this:

RewriteRule ^([0-9]+)$ index.php?pix=$1
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading