writing if condition in htaccess file for url rewrite

Viewed 1195

My htaccess code for URL rewrite is as follows

RewriteEngine On
RewriteBase "/myekc/"
RewriteCond %{REQUEST_URI} ^/myekc/
RewriteCond %{REQUEST_FILENAME} !/(css|images|js)/ 
RewriteRule "/t/pepsi/(.*)$" "http://192.168.0.175:68/$1" [P]
RewriteRule "^(.*(?:xampp|htdocs)/)(.+)$" "http://192.168.0.179/myekc/t/pepsi/$2" [R,QSA,L]

This works for 1 URI. I now want to write if condition, in such a way to write for multiple uri Eg:

<If "req('uri') == '/t/pepsi/'">
RewriteBase "/myekc/"
RewriteCond %{REQUEST_URI} ^/myekc/
RewriteCond %{REQUEST_FILENAME} !/(css|images|js)/ 
RewriteRule "/t/pepsi/(.*)$" "http://192.168.0.175:68/$1" [P]
RewriteRule "^(.*(?:xampp|htdocs)/)(.+)$" "http://192.168.0.179/myekc/t/pepsi/$2" [R,QSA,L]
</if>
<If "req('uri') == '/t/coke/'">
RewriteBase "/myekc/"
RewriteCond %{REQUEST_URI} ^/myekc/
RewriteCond %{REQUEST_FILENAME} !/(css|images|js)/ 
RewriteRule "/t/coke/(.*)$" "http://192.168.0.175:68/$1" [P]
RewriteRule "^(.*(?:xampp|htdocs)/)(.+)$" "http://192.168.0.179/myekc/t/coke/$2" [R,QSA,L]
</if>
1 Answers
Related