Forum Moderators: phranque

Message Too Old, No Replies

redirect /27/t/1165 to 1165.html

         

Ahni

5:08 pm on Jul 16, 2005 (gmt 0)

10+ Year Member



my eyes are burning from all the reading and I can't find an answer, so please could someone tell me how I can achieve a redirect like:

/show.php/act/ST/f/27/t/1165 to read/1165.html

/show.php/act/ST/f/27/t/3387 to read/3387.html

/show.php/act/ST/f/3/t/186 to read/186.html

I got about 5000 pages like this, so one by one is not an option...

thanks,

Ahni

Ahni

8:51 pm on Jul 17, 2005 (gmt 0)

10+ Year Member



Well I almost figured it out :), just missing one thing.

this is what I have so far:

RewriteEngine on
RewriteRule ACT/ST/f/3/t/(.*)$ directory/$1\.html [R=301,L]

what's missing is the "/t/filename" gets changed to "tfilename.html"

could someone give me a hint on what I can do here

(and please scratch my first post, I wrote it wrong)

Thanks

-Ahni

Ahni

2:22 am on Jul 18, 2005 (gmt 0)

10+ Year Member



Hey. Well I seem to have solved it :D

RewriteRule act/ST/f/4/t/(.*)$ [web.site...] [R=301,L]

but I've discovered another question I do need some help with... how to redirect /forum/index.php?s=f65675fa27e8267bfc13d1a515985d5e&showtopic=887

to /read/t887.html

I'm not too sure how to deal with the session? could I just supress it or something?

Thanks

jd01

2:39 am on Jul 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will need to use a RewriteCond %{QUERY_STRING} for Apache to 'see' information after the ?

I do not know your exact situation, except for the URL posted, so if this is not exact, it should get you close:

RewriteCond %{QUERY_STRING} s=[^&]&[a-z]+=([0-9]+) [NC]
RewriteRule ^forum/index\.php$ /read/t%1.html [R=301,L]

Rule: if the requested URL is forums/index.php redirect it to /read/tVARIABLE.html if the Condition is met. The %1 is the first (and in this case only) variable from the Condition.

Condition: if the Query String starts with s= followed by anything that is not a &, then has an & followed by one or more letters from a to z, then has an = followed by one or more numbers from 0 to 9 - () create a variable, so we store the numbers in a variable. NC is for No Case, so we match both upper and lower case strings.

Hope this helps.

Justin

Ahni

3:18 pm on Jul 18, 2005 (gmt 0)

10+ Year Member



Hey justin. Thank you for the response.

I tried what you gave me, but

ghostchild.com/forum/index.php?s=d35ca0e7a5843c501d946045f3074158&showtopic=728

was still 404

So I don't make this more confusing, here's what's in the .htaccess in the /forum/ directory
=====
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /forum/index\.php\?showtopic=([0-9]+)\ HTTP/
rewriterule ^index\.php$ /read/t%1.html [R=301,L]

rewriterule ^t([0-9]+)\.html$ /forum/index.php?showtopic=$1 [L]

RewriteRule show.php/act/ST/f/3/t/(.*)$ /read/t$1\.html [R=301,L]
RewriteRule show.php/act/ST/f/27/t/(.*)$ /read/t$1\.html [R=301,L]
RewriteRule show.php/act/ST/f/28/t/(.*)$ /read/t$1\.html [R=301,L]
RewriteRule show.php/act/ST/f/4/t/(.*)$ /read/t$1\.html [R=301,L]
RewriteRule show.php/act/ST/f/22/t/(.*)$ /read/t$1\.html [R=301,L]
RewriteRule show.php/act/ST/f/5/t/(.*)$ /read//t$1\.html [R=301,L]

RewriteRule show.php/ar /media_archive/files/Glossaries\ and\ Dictionaries/ [R=301,L]
==========
Is there something I'm doing wrong which is preventing what you gave me from working?

jdMorgan

7:20 pm on Jul 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ahni,

Welcome to WebmasterWorld!

There was no provision in your rule for the SID. You'll need to modifiy the pattern:


RewriteCond %{THE_REQUEST} ^[A-Z]+\ /forum/index\.ph[b]p\?.*s[/b]howtopic=([0-9]+)\ HTTP/

For more information, see the regular-expressions tutorial cited in our forum charter [webmasterworld.com].

Jim

Ahni

9:57 pm on Jul 18, 2005 (gmt 0)

10+ Year Member



Thanks Jim. Yeah I had read that, but then promply lost it :(, but now is bookmarked for future reference.

Also, for the sake of mentioning it, this has all been about redirecting an Invision Power Board (the lo-fi or lofiversion to be exact)

Cheers, and thanks again for both your guidance/assistance.