Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite - URL and HREF questions

URL rewrite and dynamic HREFs.

         

password1

6:16 pm on Oct 25, 2006 (gmt 0)

10+ Year Member



Hi all,

I'm working with mod_rewrite and I can view the site using the altered URL e.g. fullstory.php?docid=13 ¦ /docid/13/.

Can mod_rewrite alter the dynamic address behind the scenes so the dynamic HREFs and GETs don't break? If that makes sense... Or is there some type of workaround?

Thanks.

password1

7:00 pm on Oct 25, 2006 (gmt 0)

10+ Year Member



"mod_rewrite acts in the URL-to-file translation phase of the Apache API, and can change the default URL-to-filename mapping. It acts after a URL is requested from your server, but before any content-handlers are invoked to output page content and before any scripts are executed. It does not change the links on your pages."

One of JdMorgans posts. It's becoming clearer now.

password1

12:17 am on Oct 26, 2006 (gmt 0)

10+ Year Member



Alright... I'm still lost and any help would be greatly appreciated.

From searching it sounds like I may need a script to do this. Am I on the right track here?

Cheers.

jdMorgan

3:52 am on Oct 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The whole point of using 'static-looking' URLs is to make it easier for search engine spiders to crawl your site -- They often get lost or leave early if fed too many query-string parameters, parameters that vary in order, session ID parameters, and the like. They like "static-looking" links.

So the idea is to always use static-looking HREFS for all of your on-page links. Once such a link is clicked and that static-looking URL is requested from your server, mod_rewrite then converts it to the dynamic URL-path needed for your page-generation script to function properly. The URL-path only exists in dynamic form when it must -- while invoking the page-generation script.

The "Changing dynamic URLs to static URLs" post in the Apache forum section of the WebmasterWorld library [webmasterworld.com] may prove quite useful to you, if read carefully and thoroughly (specific terms have very specific meanings, not to be confused).

Jim

password1

4:09 pm on Oct 26, 2006 (gmt 0)

10+ Year Member



I'm off to read.

Thanks.

password1

1:32 am on Oct 27, 2006 (gmt 0)

10+ Year Member



The URL now shows the docid # and the title of the requested page seperated by -'s. Works like a charm. Cheers.