Home Apache rewrite configuration not working
Reply: 0

Apache rewrite configuration not working

user873
1#
user873 Published in May 23, 2018, 10:47 pm

I have a use case where I only want to forward the request to localhost only if url of the below forms and ItemType equals x.

http://example.com:15790/d/ItemType=x&id=3
http://example.com:15790/ItemType=(anything)

RewriteCond %{THE_REQUEST} !\s/d/
RewriteCond %{QUERY_STING} (?:^|&)ItemType=(x)(?:&|$) [NC]
RewriteRule ^/(.*)$  http://google.com/$1 [R=301,L,NC]

RewriteCond %{THE_REQUEST} \s/d/
RewriteCond %{QUERY_STRING} (?:^|&)ItemType=(x)(?:&|$) [NC]
RewriteRule ^/?d/(.*)$  http://localhost:15790/$1 [P,NE,L,NC]

The above configuration is not working for me. First rewriting works fine but second is also using the first rewriting. Can somebody explain me what I am doing wrong?

Note:I am new to this rewriting URLs. Also can somebody help me with where I can find the logs?

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO