Forum Moderators: phranque

Message Too Old, No Replies

(mod rewrite) I'm stupid. Help me

         

m8fyu

10:51 pm on May 24, 2011 (gmt 0)

10+ Year Member



OK. I'm totally new to mod rewrite and have been following an online tutorial in order to get a better understanding of what it can do.

So I've rewritten my ugly url
[mysite.com...]

to appear as
[mysite.com...]

Now whether I enter either of the above I get the same page, which is great. What's confusing me is how the search engines will index the right one.

Am I right in thinking that if a user enters my ugly url, thats what will appear in the address bar? Obviously I want the new pretty url to be the only one thats ever seen.

Can anyone briefly explain this to me please? I've exhausted myself trying to find information to enlighten me but all I seem to be finding are step-by-step tutorials that don't help me to understand.

g1smd

11:29 pm on May 24, 2011 (gmt 0)

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



You have a rewrite to connect SEF URL requests to the ugly internal script filepath. That's step one.

Step two is to make sure that all of the links on the pages of your site point only at the new SEF URLs.

Step three is to add a 301 redirect such that if the old URL is requested, the user or bot is redirected to the new URL. On encountering such a redirect, searchengines update their list of URLs for your site within their index.

The extra redirect code must test THE_REQUEST in a preceding RewriteCond, otherwise you will end up with a infinite redirect-rewrite loop. List the redirects before the rewrites.

There are literally thousands of prior posts with example code, as this is a question that has been asked in this forum several times per month for the last decade.

m8fyu

8:13 am on May 25, 2011 (gmt 0)

10+ Year Member



Thanks g1smd, that really helps. Now I have a starting point to dig a little deeper.
Thanks again!

phpJoeMo

12:22 am on May 27, 2011 (gmt 0)

10+ Year Member



FYI: I'm finding the actual documentation to more useful than anything else:
[httpd.apache.org ]

You can also download the docs as html and make a .chm file for faster access.

Just a thought...