Forum Moderators: phranque

Message Too Old, No Replies

Another mod_rewrite question (best practices, not technical)

Whether or not to enforce access through "friendly" URL

         

Tvienti

2:41 pm on Aug 23, 2005 (gmt 0)

10+ Year Member



Hello all. I'm in the process of configuring my server to accept friendly alternatives to all my existing URLs (which are being indexed and regularly visited). Once this is done and running smoothly, is there any advantage to forcing people to access my pages through the friendly URL via redirects? Would this help my standings with SEs?

jdMorgan

3:00 pm on Aug 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The usual practice is to internally rewrite from the "friendly" URIs to the "real" URIs in order to make the site work.

Then, in order to clean up ugly URLs and avoid PageRank and link-popularity dilution due to duplicate content in the search engines, the old "real" URIs are externally 301-redirected to the friendly URIs.

In mod_rewrite, it is necessary to use the server variable {THE_REQUEST} in order to avoid the 'infinite' loop that would result from an improper implementation of the above strategy. Oops! - That's technical. :)

Jim

Tvienti

9:26 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



I'm sorry, I have to get technical. I'm having a hard time with this. Here is how I set up my htaccess file:

RewriteCond %{THE_REQUEST} /ProductDetails\.php\?pid=(\d*)
RewriteRule (.*ProductDetails\.php)/Products/%1//Details.html [R]

The rewrite works fine with one exception:

[mysite.com...]

becomes

[mysite.com...]

How can I prevent that?pid=123 at the end of the rewritten URL?

jdMorgan

9:30 pm on Aug 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add a question mark to the end of the new URL. This clears the current query string.

I'm not sure why you have two slashes in your substitution URL. I cannot recommend that you do that.

Jim