Forum Moderators: phranque

Message Too Old, No Replies

The Rewrite rules are not working

         

icsraj

5:30 pm on Sep 28, 2007 (gmt 0)

10+ Year Member



I have rewrites and Mod_jk, I have hrefs in my site which has urls like

http://localhost/download/documents/about_us/partners.pdf

In the page the href url needs to be showns as, The documnet is skipped in the display.

http://localhost/documents/about_us/partners.pdf

I have the following rules, However i am not getting the URL to be shown on the Page.

RewriteRule ^/documents/(.*)$ /download/docuements/(.*)/$1 [PT,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /download/documents/(.*)\ HTTP/
RewriteRule ^/download/documents/(.*)$ http://%{HTTP_HOST}/documents/%1? [R=301,L]

any help is highly appreciated.

[edited by: jdMorgan at 11:01 pm (utc) on Sep. 28, 2007]
[edit reason] de-linked [/edit]

jdMorgan

10:50 pm on Sep 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mod_rewrite cannot change the links on your pages; It only changes the filename used to serve content when a link (URL) on your page is clicked.

Change the links on your pages, then use mod_rewrite to detect the modified URL and rewrite it to the actual server filepath needed to get and serve the content.

Jim

g1smd

9:32 pm on Sep 29, 2007 (gmt 0)

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



The redirect code that you posted has a flaw. It does not fix the www vs. non-www canonicalisation problem. It allows both to be indexed.