Jump to content

Recommended Posts

Hi guys,

 

I could really do with some help here please...

 

I am replacing my website and need to redirect ALL urls that are this format:

 

http://www.domain.com/profile.php?user=Fay123

 

to

 

http://www.domain.com

 

The profile name can be upper or lowercase and can consist of both characters  and numbers.

 

I have tried adding this to my .htaccess file:

RewriteRule ^profile.php?user=(.*) http://www.domain.com

 

..but it doesn't work.

 

Can any of you smart guys help me out here please.  I have about 400 profiles indexed in Google that are don't want to lose.

 

Thanks

Rob

Sorry I should have explained in more detail.

 

I am building a new site on a new server and asking existing members of my old site to reregister on the new server.  The CMS I'm using is totally diffferent, and so I wanted to redirect all old profile pages indexed by Google to the NEW homepage.

 

Is this not really a good idea then?

 

If it is viable can you please assist me with the code I need to achieve this?

 

Regards

Rob.

Ahh, well given the fact that you do in fact want all the pages to end up at the same page, then yes, that does make a bit more sense. Something like this should do the job...

 

RewriteCond %{QUERY_STRING} user=[a-zA-Z0-9_-]+
RewriteRule ^profile.php$ / [R=301,L]

 

... though by the sounds of it you don't even need that much, since you aren't actually using the username, is there a reason you are matching against it in the query? Can you not just redirect any requests to profile.php to the home page?

Cags, thank you so much...

 

Yes,  anything that has profile.php within the url should be redirected to the new homepage.

 

so... do I simply need this:

 

RewriteRule ^profile.php$ / [R=301,L]

 

...or am I missing something here?

 

Appreciate your help with this

Thanks

Rob.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.