cowboysaif cowboysaif - 1 month ago 6x
PHP Question

What should be the .htaccess rule for following condition?

I have following links :

which should convert to :

Also, .css, .js etc files needs to avoid this rule. My .htaccess file so far is this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/(.*)?$ $2/$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).html$ index.php?query=$2&type=$1&link=seo [L]


Problem is, now we have an admin panel. The css and js files are falling into into the
^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/(.*)?$ $2/$3
Example of such link:

How can i modify the rule so that "if it NOT contains the word admin..." ?


Add a condition before first rule:

RewriteCond %{REQUEST_URI} !^admin