.htaccess rewrite issue
Posted
by
Jessica
on Server Fault
See other posts from Server Fault
or by Jessica
Published on 2012-06-28T11:24:57Z
Indexed on
2012/06/28
15:18 UTC
Read the original article
Hit count: 214
Below is my .htaccess file for my website on shared hosting - I'm attempting to send all requests to index.php with parameter 'q' where I wish to parse data etc... unless it's an existing file or directory.
So my issue, if I attempt to browse to an actual directory expecting to get an unauthorized notice (options -Indexes) it sends me to my index.php and I also noticed that print_r($_GET)
it gives me this: Array ( [q] => 403.shtml )
AddDefaultCharset UTF-8
Options -Indexes +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
Help would be much appreciated if possible :)
© Server Fault or respective owner