Home I have .htaccess rewrite rure which also rewrite folders
Reply: 0

I have .htaccess rewrite rure which also rewrite folders

user990
1#
user990 Published in June 19, 2018, 6:25 pm

This is my code:

RewriteRule    ^([A-Za-z0-9-]+)/?$    index.php?category=$1    [NC,L]
RewriteRule    ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)    index.php?category=$1&subcategory=$2    [NC,L]

Now the problem is, It actually treats directory and subdirectory as category and sub-category respectively. I have tried many different solutions to leave directory untouched but none seem to work.

someone suggest me:

RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule .* - [L]

AND

RewriteCond %{REQUEST_URI} !^/css
RewriteCond %{REQUEST_URI} !^/js
RewriteCond %{REQUEST_URI} !^/images
RewriteCond %{REQUEST_URI} !^/digitalserp
RewriteCond %{REQUEST_URI} !\.(?:css|js|jpe?g|gif|png)$ [NC]

None works until now. Please suggest me the best way to make clean URL like http://www.example.com/category/sub-category without rewriting all the CSS, JS and Images.

Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.321452 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO