cowboysaif cowboysaif - 1 year ago 65
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..." ?

Answer Source

Add a condition before first rule:

RewriteCond %{REQUEST_URI} !^admin
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download