1

I have in my .htaccess

RewriteEngine On

RewriteRule ^([a-z0-9\-\_]+)$ ?page=$1 [L]

Which rewrites mysite.com/page to mysite.com/?page=page which works fine. When I go to mysite.com/css is will ignore the rewrite and go to the css directory (which exists). Is there anyway to have it ignore that the directory exists and continue on going to mysite.com/?page=css ?

Edit: I should add more specifically that when going to mysite.com/css is actually goes to mysite.com/css/?page=css

  • 2
    Is that the only rule in your root .htaccess and do you have .htaccess in `/css/` folder also? – anubhava Sep 15 '14 at 18:39
  • possible duplicate of [Deny access to one specific folder in .htaccess](http://stackoverflow.com/questions/19118482/deny-access-to-one-specific-folder-in-htaccess) – zod Sep 15 '14 at 18:42
  • @zid: OP doesn't want to deny access to any folder here. – anubhava Sep 15 '14 at 18:44
  • Yes that's the only rule in my root .htaccess. And no .htaccess in the /css directory. – PumpkinJack Sep 15 '14 at 18:48

1 Answers1

0

This is due to your rule running twice. Change your rule to this to prevent this behavior:

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^([\w-]+)/?$ ?page=$1 [L,QSA]
anubhava
  • 761,203
  • 64
  • 569
  • 643