Mihail Mojsoski Mihail Mojsoski - 3 months ago 11
Apache Configuration Question

URL Rewrite PHP .htaccess

I do not know how i can code the .htaccess file to make it rewrite a URL like this:

http://www.domain.com/one/two/three?four=five&six=seven


into this:

http://www.domain.com/RequestHandler.php?path=one/two/three&four=five&six=seven


I am not sure if this even possible, if it is impossible tell me.

Answer

You can use in your .htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ /RequestHandler.php?path=$1 [QSA,L]