views:

21

answers:

1
+1  Q: 

.htaccess issue

I'm using the .htaccess file below to force a redirect to a "language prefix" if none is found in the url. So if domain.com/news is typed it redirects to domain.com/en/news - this works fine.

This rule should not be applied to certain folders like images, swf and myphp. It works fine for the first two, so when I access domain.com/swf I see a list of directory content and "en" is not added.

But, it doesn't work for the "myphp" folder (this is a phpmyadmin installation). Normally it would load myphp/index.php but adding the file name to the rule makes no difference. The page just keeps loading but nothing happens. Does anyone know why?

RewriteEngine On
RewriteBase /

#force redirect to language specific page
RewriteCond $1 !^(en|fr|nl)$

#dont apply the rule to the assets folders
RewriteCond $1 !^images$
RewriteCond $1 !^swf$
RewriteCond $1 !^myphp$

#redirect to default EN page if no language param is present in URI
RewriteRule ^([^/]+)/.* /en/$0 [L,R=301]

#remove index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteRule ^(.*)$ /index.php?$1 [L]
+1  A: 

seems to me that you might be running into problems due to trying to match the end of the line ($) after the folder name when there's more in the url. What happens if you leave the dollar sign off of your folder names?

Ty W