1

Our .htaccesss file has the following rules which is affecting access to our admin pages.

The rules are setup to allow something like the following:

http://www.example.com/en-gb/section/product/

#Most pages are caught by this so we can use the translated token stored in cms rather than having to fix here
RewriteRule ^([a-zA-Z]{2})-([a-zA-Z]{2})/([a-zA-Z0-9\-_]+)(/?)$                                         index.php?html/pages/$3                     [L,NC]

#Product pages
RewriteRule ^([a-zA-Z]{2})-([a-zA-Z]{2})/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)(/?)$                       index.php?html/pages/$4                     [L,NC]

#Product subscription pages
RewriteRule ^([a-zA-Z]{2})-([a-zA-Z]{2})/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)(/?)$     index.php?html/pages/$5                     [L,NC]

Unfortunately this is affecting the admin pages, e.g. http://www.example.com/en-gb/admin which is firing a 404.

Basically, is there any way to ignore the above rule if the path contains /admin?

I've tried a RewriteCond before the RewriteRule but it doesn't seem to be working.

Cheers!

Craig
  • 337
  • 2
  • 10
  • 1
    Looking at your rule, `/en-gb/admin` shouldn't be matched by it since you set third parameter as compulsory. Do you have other rules ? – Justin Iurman Jan 13 '15 at 13:37
  • check here http://stackoverflow.com/questions/1848500/htaccess-mod-rewrite-how-to-exclude-directory-from-rewrite-rule –  Jan 13 '15 at 13:39
  • @JustinIurman Sorry, that was just an example. There appears to be 3 rules which are affecting it. I've updated the original post. – Craig Jan 13 '15 at 15:16

1 Answers1

0

Thanks @JustinIurman but I couldn't get your answer to work unfortunately.

It was a much simpler solution than I thought in the end.

I just changed the rule to the following:

+RewriteRule ^([a-zA-Z]{2})-([a-zA-Z]{2})/(?!admin)([a-zA-Z0-9\-_]+)(/?)$

Thanks for your help.

Craig
  • 337
  • 2
  • 10