regex - URL rewriting to a folder if url has one pattern and ignore the rule if url has another pattern -


i have following directory structure project

example   admin/   cdn/   client/   .htaccess 

when url

  • http://192.168.1.121/example/ or
  • http://192.168.1.121/example or
  • http://192.168.1.121/example/category/productname or
  • http://192.168.1.121/example/content/12 , on,

it should rewrite client/ folder.

but if url has http://192.168.1.121/example/cdn, should ignore rule.

can me on this. how write rule in .htaccess

thanks

you can use /example/.htaccess:

rewriteengine on rewritebase /example/  rewriterule ^(?!client/|cdn)(.*)$ client/$1 [l,nc] 

(?!client/|cdn) negative lookahead ignore rule when uri /example/cdn or /example/client


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -