Mod_rewrite with question marks

I'd like to redirect from:

faculty/faculty.php?sid=faculty  

to    

faculty/
liz2008Asked:
Who is Participating?
 
caterham_wwwConnect With a Mentor Commented:
Since the filename differs between "input" and "output", you'll need "hard-coded" rules, i.e. they cannot be generic
RewriteEngine on
RewriteCond %{QUERY_STRING} =sid=faculty
RewriteRule ^faculty/faculty\.php$ /faculty/? [R=301,L]
 
RewriteCond %{QUERY_STRING} =sid=faculty
RewriteRule ^faculty/faculty_core\.php$ /faculty/scientific_cores.html? [R=301,L]
 
RewriteCond %{QUERY_STRING} =sid=faculty
RewriteRule ^faculty/faculty_laboratories\.php$ /faculty/labs_centers.html? [R=301,L]
 
RewriteCond %{QUERY_STRING} =sid=faculty
RewriteRule ^faculty/faculty_resources\.php$ /faculty/biology_resources.html? [R=301,L]

Open in new window

0
 
caterham_wwwCommented:
So you'd like to check the QueryString:
#/.htccess:
RewriteEngine on
RewriteCond %{QUERY_STRING} =sid=faculty
RewriteRule ^faculty/faculty\.php$ /faculty/? [R=301,L]

Open in new window

0
 
liz2008Author Commented:
That works great! thank you.  
I have many more that I need to redirect, and I have not figured out the pattern.

For example:

1. faculty/faculty.php?sid=faculty               to                 faculty/

2. faculty/faculty_core.php?sid=faculty     to              faculty/scientific_cores.html

3. faculty/faculty_laboratories.php?sid=faculty    to               faculty/labs_centers.html

4. faculty/faculty_resources.php?sid=faculty     to     faculty/biology_resources.html


thank you!
Liz
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.