Reputation: 1055
I have use the below htaccess script to purse url for my website:
RewriteEngine on
RewriteRule ^([A-Za-z0-9_-]+)/?$ index.php?con=$1 [L]
RewriteRule ^(administrator|admin)/([A-Za-z0-9_-]+)/?$ index.php?cms=$1&controller=$2 [L]
RewriteRule ^([A-Za-z0-9_-]+)/([^/]+)/?$ index.php?controller=$1&action=$2 [L]
RewriteRule ^(administrator|admin)/([A-Za-z0-9_-]+)/([^/]+)/?$ index.php?cms=$1&controller=$2&action=$3 [L]
I have url like:
http://example.com/search/country-name/
here:
controller = search;
action = country-name;
if the url is: http://example.com/admin/search/country-name/
then
cms = admin
controller = search;
action = country-name;
Now problem is I am unable to access my assets file ( css, js, image, etc files ). Becacue htaccess purse those below url also!
-> http://example.com/assets/css/style.css
or,
-> http://example.com/assets/js/style.css
or,
-> http://example.com/assets/image/image_name.jpg
What should i do so that htaccess do not purse the url http://example.com/assets/ and what ever in the assets folder ..
Upvotes: 0
Views: 650
Reputation: 18671
Add this after RewriteEngine on
:
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
Like that, you avoid to rewrite real file or directory.
Upvotes: 2
Reputation: 205
Try to add
RewriteCond %{REQUEST_URI} !(css|js|fonts|images)
into your htaccess. (css/js/fonts/images) are the folder name
Upvotes: 1