Forum Moderators: phranque

Message Too Old, No Replies

RewriteRule working but URL is wrong

RewriteRule working but URL is wrong

         

k_tammam

1:58 pm on Jun 25, 2008 (gmt 0)

10+ Year Member



Hi,

I put this line in file .htaccess:

RewriteRule a06_com/([0-9]+)/([0-9]+)\.html$ a06_query6.php?pointer=$1&total_records=$2 [L,NC]

after request the url become:

[mysite.com...]

untill now every thing is good and the query working, but in this page I have 'Next' link to braws database, when I click this linke the secode page come but the Url becomes:

[mysite.com...]

and the third url page becomes:

[mysite.com...]

and so on..

How I can solve this problem?

Thanks

jdMorgan

3:23 pm on Jun 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In the links on your pages, use server-relative URL-paths or canonical URLS, and not page-relative URLs.

That is, use <a href="/path-to-Next-page"> or <a href="http://www.example.com/path-to-Next-page">, not <a href="path-to-Next-page">

You may also need to do the same with the URLs for included images, media files, external JavaScripts, CSS stylesheets, etc.

Remember that it is the client (e.g. the browser) that resolves relative links, based upon the "page URL" that it is showing in the address bar.

Also, be aware that your .htaccess code does not "change" the URL in the way that you seem to think it does; The link on your page defines the URL. The browser resolves and then requests that URL. When the request for that "http://www.example.com/01_com_search/a06_com/50/154395.html" URL arrives at your server, that URL is internally rewritten to the "/a06_query6.php?pointer=50&total_records=154395" filepath.

So while the server filepath associated with the client-requested URL is changed from what it would be if mod_rewrite was not used, the URL itself is not changed at all by mod_rewrite; Only modifying the links on your page actually changes the URL. Hopefully, understanding the actions that take place, where they take place, and the order in which they occur will clarify things for you.

Jim

k_tammam

10:54 pm on Jun 25, 2008 (gmt 0)

10+ Year Member



Hi,

Wonderful .. I have spent more than three weeks into this problem .. And now it has been resolved.. Thank you very much. it's working now.

Khaled tammam