Tuesday, 15 March 2011

apache - htaccess - redirect only non-subdomain requests -


... except for www, which is also a subdomain, of course.

This is my present HTACCase rule with the comments:

  Rewrite on the login #REDRIVED # www. HTTP_HOST! ^ Www. RewriteRule ^ (. *) $ Http: //www.% {HTTP_HOST} / $ 1 [R = 301, L] # What does this do? RewriteCond% {REQUEST_FILENAME}! -f rewrite code% {REQUEST_URI}! ^ / Login / #index.php?action=a&urlId=1 rewrite rule ^ ([^ /] +) / ([^ /] +) /? $ Index.php? Action = $ 1 and URIID = $ 2 [L, QSA] #Warreal / A to / Indx.fp? Action = A rewrite Raul ^ ([^ /] +) /? .php? Action = $ 1 [L, QSA]   

Now my problem is, I have asked two subdomains a.domain.com and b.domain.com which point to the same directory. And for that go through the same htaccess - but they are used directly for static file-logging. How can I prevent a.example.com and b.example.com to fully use the above rules?

And perhaps someone can tell what this is:

  # What does this do? RewriteCond% {REQUEST_FILENAME}! -f RewriteCode% {REQUEST_URI}! ^ / Login /   

Thanks!

The solution is to add a condition that checks that the host domain.com does execute the rewrite rule First checks

  RewriteCond% {HTTP_HOST} ^ (www \.)? Domain \ .com $   

Regarding your second question, one or more revittance instructions are not separate instructions, but are linked to a rewriting rule, they are the conditions that rewrite the rules Are valid for execution.

In your case:

  rewrite angle% {REQUEST_FILENAME}! -f RewriteCode% {REQUEST_URI}! ^ / Login / rewrite rule ^ ([^ /] +) / ([^ /] +) /? $ Index.php? Action = $ 1 and urlId = $ 2 [L, QSA]   

The rewrite rule is executed, if requested Yuri does not indicate there is a file, and / login /

No comments:

Post a Comment