| :: |
| Author |
Message |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 3:14 am Post subject: 301 Redirect and Rewrite Help Please |
|
|
Originally, I was using the WebMedic sitemap and rewrite mod. I have a few thousand pages currently in Google, but they are no longer valid because my forum has been moved out of my root, into a directory called /discussion.
Now I am using the SEO Advanced Rewrite mod and my forum has been moved out of the root into the discussion directory. The links generated by WebMedic and SEO are compatible, so I basically just need to know how I would do a 301 redirect in this format:
"blah-blah-vtxx.html" to "/discussion/blah-blah-vtxxx.html"
"-vpxxx.html" to "/discussion/-vpxxx.html"
"blah-vfxx.html" to "/discussion/blah-vfxx.html"
I am guessing it can be done with just three lines in the .htaccess file, but I have no clue what they would be.
Thanks! |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15127
|
|
| Back to top |
|
 |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 8:16 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
Thank you so much for the help. This place is great!
This seems to work pretty well most of the time. One thing I have noticed though is that if the link has no text in front of the hyphen(-), then the link is not redirected.
For example (view topic), http://www.weimaraneraddict.com/-vt3205.html does not get redirected, but http://www.weimaraneraddict.com/happy-easter-vt3205.html works perfectly.
The same things happens with view post (and everything else), http://www.weimaraneraddict.com/-vp16637.html does not get redirected, but http://www.weimaraneraddict.com/happy-easter-vp16637.html works perfectly.
(And just FYI, the first link such as http://www.weimaraneraddict.com/-vp16637.html is being caught by my 404 catch all, so while it looks like it is getting redirected, it isn't.) |
Last edited by GrayGhost on Sun Oct 15, 2006 8:24 pm; edited 1 time in total |
|
| Back to top |
|
 |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 8:21 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
Well, I am using this string for -vp and it "seems" to work. Any problems with this string? | Code: | | RewriteRule ^.*-vp([0-9]+)\.html$ http://www.domain.com/discussion/post$1.html [QSA,L,R=301] |
|
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15127
|
Posted: Sun Oct 15, 2006 9:22 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
You're welcome
| Code: | RewriteRule ^([^discussion/].*)-vp([0-9]+)\.html$ http://www.example.com/discussion/post$2.html [QSA,L,R=301]
RewriteRule ^([^discussion/].*)(-vc|-vf|-vt)([0-9]+)\.html$ http://www.example.com/discussion/$1$2$3.html [QSA,L,R=301] |
will do the trick.
".+" means at least (the +) some text (the dot ".") and ".*" means some or none.
I'm always concerned about making the rewriterule as strict as possible, to avoid weird exceptions, which in some cases, like here, is causing some trouble
So you should be set with those
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 9:28 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
| GrayGhost wrote: | Well, I am using this string for -vp and it "seems" to work. Any problems with this string? | Code: | | RewriteRule ^.*-vp([0-9]+)\.html$ http://www.domain.com/discussion/post$1.html [QSA,L,R=301] |
|
Oops, I think was editing at the same time you wrote your reply.
After reading another post here, I had already tried exactly what you suggested (the .* instead of .+), but it did not seem to work. However I got this to work correctly for the -vp | Code: | | RewriteRule ^.*-vp([0-9]+)\.html$ http://www.domain.com/discussion/post$1.html [QSA,L,R=301] | Will this work alright, or might it cause some issues?
I am still trying to get the other line to work right. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15127
|
|
| Back to top |
|
 |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 9:35 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
Yes I did, I had attempted that already after reading a similar post.
And just to make double sure, I tried it again copy and pasting exactly from your post.
It still didn't work correctly for some reason. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15127
|
|
| Back to top |
|
 |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 9:41 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
| Yea, but that is because I am using this: |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15127
|
|
| Back to top |
|
 |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 9:44 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
Here, I will put your code in there for you to see.
And yes I realize I need to limit some of via robots.txt for page rank, I need the redirect in there for people too (old links in my forum, or other places out on the web).
Ok I got your code back into the .htaccess file now. Take a look. |
|
|
| Back to top |
|
 |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 9:47 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
| dcz wrote: | Oh I see, you're not looping because we use postxx.html
Because this would not have been possible without making sure discussion/ was not part of the requested URI with -vt for example.
So I guess we got it now
++ |
Yea, it seems to be a working solution for -vp because -vp becomes post in your mod, but what about -vt -vf and -vc?? |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15127
|
|
| Back to top |
|
 |
GrayGhost
Joined: 12 Oct 2006 Posts: 15
|
Posted: Sun Oct 15, 2006 9:59 pm Post subject: Re: 301 Redirect and Rewrite Help Please |
|
|
I skimmed through several pages of the search results, and it seems that ONLY -vp actually have empty titles. Everything else does have text.
So I guess that means there is really no need to attempt to fix the rest, since it isn't broke.
Thanks for all of your help and putting up with my ignorance. I am learning though!  |
|
|
| Back to top |
|
 |
|
|