Link to home
Start Free TrialLog in
Avatar of Aidam-Unlimited
Aidam-UnlimitedFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Mod Rewrite: script/var1/var2/var3 [three different files]

Hello,

I have following files:
script1.php
script2.php
script3.php

script1.php?s=ss&c=cc&p=all
=
/script1/ss/cc/all

script2.php?s=ss&c=cc&d=dd&p=all
=
/script2/ss/cc/dd/all

script3.php?s=ss&c=cc&d=dd&cg=gg&p=all
=
/script3/ss/cc/dd/gg/all

Please, could somebody suggest me a Mod_Rewrite file for that?

Thank you in advance!
Adam
Avatar of Avinash Zala
Avinash Zala
Flag of India image

Try below rules i your .htaccess file

RewriteRule ^script1/ss/cc/all$ script1.php?s=ss&c=cc&p=all [NC,L]
RewriteRule ^script1/ss/cc/all/$ script1.php?s=ss&c=cc&p=all [NC,L]

RewriteRule ^script2/ss/cc/dd/all$ script2.php?s=ss&c=cc&d=dd&p=all [NC,L]
RewriteRule ^script2/ss/cc/dd/all/$ script2.php?s=ss&c=cc&d=dd&p=all [NC,L]

RewriteRule ^script3/ss/cc/dd/gg/all$ script3.php?s=ss&c=cc&d=dd&cg=gg&p=all [NC,L]
RewriteRule ^script3/ss/cc/dd/gg/all/$ script3.php?s=ss&c=cc&d=dd&cg=gg&p=all [NC,L]


Hope this helps.
Addy
Avatar of Aidam-Unlimited

ASKER

Hi Addy, thanks for fast response.

I forgot to mention that variable values are changeable.

So everything what is fixed is script name and variable name, but variable value is always different.
For example, s=abc, s=jdcjsdcksn.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Avinash Zala
Avinash Zala
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent, perfect. Thanks a lot!