1

I'm trying to rewrite www.domain.com/something/some/ to www.domain.com/index.php?q=something/some/

This is what I have so far:

RewriteCond %{REQUEST_FILENAME} ([a-z-]+)/?$
RewriteRule (.*) index.php?q=$1 [QSA,L]

But I want to exclude urls like these: www.domain.com/#!/something

Could you please help?

Thanks, John

johny long
  • 57
  • 1
  • 4
  • 1
    The `#` and everything after that shouldn't ever reach your server, as it's a fragment identifier, which is not supposed to be attached to a request. – lxg Sep 16 '14 at 17:30

1 Answers1

2

You can use this rule in root .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?q=$1 [QSA,L]

Use of .+ also takes care of /#!/something since Apache will only get / for that as text after # doesn't reach web server.

anubhava
  • 761,203
  • 64
  • 569
  • 643