Forum Moderators: phranque

Message Too Old, No Replies

i want SEF url to appear in address bar instead of dynamic URL.

Displaying SEF url in address bar

         

amitimcc

11:02 am on Jul 25, 2011 (gmt 0)

10+ Year Member



Hi,

i am new to .htaccess file and mod_rewrite module.i want my SEF url to appear in address bar and wrote rewite rule in .htaccess file for this.

my .htaccess file is as follows:

RewriteEngine On
RewriteRule ^shopping-river-of-life-vortex-water-revitalizer-three-quarter-inch productDetailsByDiameterStorage.php?productId=20001&diameterId=50002

when i put my SEF url directly in address bar, page opens properly but if i click on any link on page,its original dynamic url appears in address bar.

my real URL is like this:

www.wlwsltd.com/shopping/storage_classes/productDetailsByDiameterStorage.php?productId=20001&diameterId=50002

Here shopping and storage_classes represents directories and i want my SEF url to appear in address bar like this:

www.wlwsltd.com/shopping-river-of-life-vortex-water-revitalizer-three-quarter-inch

Could anyone advice me how to do it ?

g1smd

6:41 pm on Jul 25, 2011 (gmt 0)

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



Mod_rewrite cannot change a URL nor can it change the links on your pages. URLs are defined in links.

You need to change the URLs in the links on the page to point to the URL that you want users to see and use. That involves manually editing the pages or editing the script which generates those on-page links.

Once the user clicks the SEF link, the browser requests that URL. The server receives that request and mod rewrite "translates" request to fetch the content from the real location inside the server where that content resides.

Add the [L] flag to the rule. This avoids difficult to diagnose problems.