Forum Moderators: phranque

Message Too Old, No Replies

Rewrite URLs containing /?p

         

acimag

8:33 pm on Jun 25, 2009 (gmt 0)

10+ Year Member



I have a website with sitelinks. Only problem i noticed is that after reduing and taking out all the ?p=Blah variables there are still a couple left and forgot how to rewrite it.

http://www.example.com/?p=Ladies_summer_Camp

I want it to show.
http://www.example.com/summer_camp/Ladies_summer_Camp.html like its coded through the site.

Im probably going to have to do it to a lot of pages after doing a site:www.example.com I see a few. same pattern for all.

I know it's simple. I just don't know how to google it.

[edited by: encyclo at 12:11 am (utc) on June 26, 2009]
[edit reason] please use example.com [/edit]

g1smd

12:01 am on Jun 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This concurrent thread asks almost the same question... [webmasterworld.com...] so it will be worth following.

acimag

6:34 pm on Jun 26, 2009 (gmt 0)

10+ Year Member



GReat. But they didn't cover a couple things. heres what I got...

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /\?p=([^\ ]*)\ HTTP/
RewriteRule ^$ [domain.com...] [R=301,L]

The only problem is it doesnt have the .html to the end. just leaves it in directory structure.

Next thing I realized after.

Most of them are ?p=blah then I noticed that SOME had ?p=blah&town=bla_g sometimes theres and underscore sometimes there isn't.

Any idea's?

jdMorgan

7:54 pm on Jun 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This fixes the ".html" problem, but may not do what you want with "town=".

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /\?[b]p=([^&\ ]*)(&(town=[^\ ]*))?[/b]\ HTTP/
RewriteRule ^$ http://www.example.com/Summer_Camp/%1[b].html[/b]?%3 [R=301,L]

As written, it redirects direct client requests for "http://www.example.com/?p=Ladies_summer_Camp&town=Aspen" to "http://www.example.com/Ladies_summer_Camp.html?town=aspen", and redirects direct client requests for "http://www.example.com/?p=Ladies_summer_Camp" to "http://www.example.com/Ladies_summer_Camp.html".

Please remember when posting here that everyone's site is different, and we don't know what you want unless you tell us exactly what you want under all possible conditions.

Jim

acimag

8:56 pm on Jun 26, 2009 (gmt 0)

10+ Year Member



I really walked into this site after someone already coded it and there are 1000's of links and pages just like this.

BTW thanks for the help with that. But if the town exist the old webmaster coded it to drop the /Summer_Camp/ and just keeps the ?p=blah/townname.html

http://www.example.com/Ladies_summer_Camp/Westport_CT.html

does that make since. This is everything I can tell you.
variable active

[edited by: encyclo at 1:47 am (utc) on July 1, 2009]
[edit reason] please use example.com [/edit]