Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite with query string

         

Mishaelo

4:04 pm on Jan 12, 2011 (gmt 0)

10+ Year Member



Hi,

Some of the pages on our site have very bad formatting (due to a script that generates them) which we would like to change to a "pretty" URL for SE and visitors alike

Case 1:
http://www.example.com/index.php?folder=SOMETEXT-SOMETEXT

Which we would like to be shown and indexed as:
http://www.example.com/SOMETEXT-SOMETEXT/

Case 2:
http://www.example.com/index.php?page=FOLDER/SOMETEXT-SOMETEXT/FILENAME.txt

Which we would like to be shown and indexed as:
http://www.example.com/SOMETEXT-SOMETEXT/FILENAME/


Obviously http://www.example.com/SOMETEXT-SOMETEXT/ and http://www.example.com/SOMETEXT-SOMETEXT/FILENAME/ don't physically exist on the server - we just want them to appear to users and indexed on SE


Been struggling with various RewriteCond and RewriteRule with no success.

Any help will be greatly appreciated

wilderness

6:35 pm on Jan 12, 2011 (gmt 0)

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



This likely been explained previously hundreds of time in this forum.

First, you correct the output which is creating these links.
(then your not stuck in a circle chasing your tail).

Second, your correct all the existing links to these formerly invalid links, and within your active web pages.

Finally, you initiate the rewrites for input-translation from websites other than your own.

Jim and g1smd, have a much better explanation of the above, and with the correct terminology, however they've both served the explanation until their blue in the face.

Suggest you search the archives (cached pages at google) for their previous examples.

As far a the rewrite itself, similar inquires have been in this forum 2-3 weekly for the past five years. There must been thousands of results in the archives.
There were two last week (or the week before) that I replied to with links to searches.

Mishaelo

7:10 am on Jan 13, 2011 (gmt 0)

10+ Year Member



Sorry for posting something which is asked over and over again but I did search the forum before posting and tried various examples found on the forum with no real success.

I might be missing basic here - I can't change the script that generates the badly formatted URLS and I don't have the physical files http://www.example.com/SOMETEXT-SOMETEXT/ - I just want them to show up for the user and SE. Is that even possible?

g1smd

8:22 am on Jan 13, 2011 (gmt 0)

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



No.

URLs are defined in links. If you can't change the links then you're sunk.

jdMorgan

5:49 pm on Jan 14, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On Apache 2.x using output filters to modify the links on-the-fly would be a possible last-ditch method.

Jim