.htaccess mod force extra characters

Posted by user1090809 on Stack Overflow See other posts from Stack Overflow or by user1090809
Published on 2011-12-11T03:47:20Z Indexed on 2012/07/05 21:16 UTC
Read the original article Hit count: 246

Filed under:
|
|

I need to be able to write/post links on the web that look like 'mysite.com/?d=foo', and take the user to filepath '/foo.php'. Here is my htaccess:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php [L]

RewriteRule ^([^/]+(/[^/]+)*)/$ /$1.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^([^.]+[^/.])$ /$1/ [R=301,L,NC] 

Baically I need to "force" '/?d=' before the filename, kinda like I've already modded my htaccess to force a trailing slash. How do I need to reconstruct my htaccess to make that possible?

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about url