1

I've searched and tried several possible solutions.

I begin with:

http:// example.com/ 729/start-page.asp?cid=4004  
http:// example.com/ 729/start-page.asp?cid=7916

and trying for:

http:// example.com/ johns-start-page  
http:// example.com/ judys-start-page

or if possible:

http:// johns-start-page.example.com/  
http:// judys-start-page.example.com/

so far I've got:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^cID=4004$  
RewriteRule ^729\.asp$ /johns-start-page [NC,R=301,L]

RewriteCond %{QUERY_STRING} ^cID=7916$  
RewriteRule ^729\.asp$ /judys-start-page [NC,R=301,L]
user692942
  • 16,398
  • 7
  • 76
  • 175
fitcher
  • 21
  • 3
  • @Jon Lin, Tried your first solution but it's being ignored. Not sure if {THE_REQUEST} is a place holder or RewriteCond %{THE_REQUEST} goes into the code verbatim. – fitcher Sep 04 '15 at 20:30
  • This was my first question on SO. I see now that it was a badly asked or plain crappy question with the -2 vote. I could have used advice on better questions instead of a kick in the ass. Thanks a lot. – fitcher Sep 05 '15 at 00:40

1 Answers1

2

As long as you're hardcoding these things, you can try:

RewriteEngine On

RewriteCond %{THE_REQUEST} \ /+729/start-page.asp\?cid=4004($|\ |\&)
RewriteRule ^ /johns-start-page? [L,R=301]

RewriteCond %{THE_REQUEST} \ /+729/start-page.asp\?cid=7916($|\ |\&)
RewriteRule ^ /judys-start-page? [L,R=301]

RewriteRule ^johns-start-page$ /729/start-page.asp?cid=4004 [L,QSA]
RewriteRule ^judys-start-page$ /729/start-page.asp?cid=7916 [L,QSA]

For the subdomains, you're going to need to make sure you have DNS setup to point those subdomains to the same IP address. Then something like:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^johns-start-page\.example\.com$ [NC]
RewriteCond %{THE_REQUEST} \ /+729/start-page.asp\?cid=4004($|\ |\&)
RewriteRule ^ http://johns-start-page.example.com/? [L,R=301]

RewriteCond %{HTTP_HOST} !^judys-start-page\.example\.com$ [NC]
RewriteCond %{THE_REQUEST} \ /+729/start-page.asp\?cid=7916($|\ |\&)
RewriteRule ^ http://judys-start-page.example.com/? [L,R=301]

RewriteCond %{HTTP_HOST} ^johns-start-page\.example\.com$ [NC]
RewriteRule ^$ /729/start-page.asp?cid=4004 [L,QSA]

RewriteCond %{HTTP_HOST} ^judys-start-page\.example\.com$ [NC]
RewriteRule ^$ /729/start-page.asp?cid=7916 [L,QSA]

But all your links could break unless you've set them up to include a FQDN.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220