Apache rewrite issue with php parameters -
i access page in following format: mysite.com/parameter instead of mysite.com/index.php?param=parameter. played around httpd.conf file , best managed mysite.com/dir/parameter.
my conf following:
options indexes multiviews includes execcgi options followsymlinks allowoverride order allow,deny allow rewriteengine on rewriterule /(.*)$ index.php?hash=$1 [nc]
how can rid of excessive directory?
changing to:
rewriteengine on rewriterule ^(.*) index.php?hash=$1 [nc]
results in following error while trying open page
forbidden
you don't have permission access /Šw^Ƙi on server.
if have configuration inside .htaccess
style file, drop leading slash (/
) , prevent rewriting of requests existing stuff:
rewriteengine on rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?hash=$1 [l,nc]
you might want add addition qsa
flag in case require additional parameters handed over.
if place such configuration in real server configuration (which far better choice if have access), current setting should fine. .htaccess
style files slow down server considerably, notoriously error prone , hard debug.
Comments
Post a Comment