Forum Moderators: phranque

Message Too Old, No Replies

Url at address bar doesn't change

url rewriting,address bar,change

         

Nilesh9

10:18 pm on Jul 13, 2009 (gmt 0)

10+ Year Member



I don't know whether its the problem of the Apache server or not but when I tried to redirect to the url the address at the address bar is not changing. I'm almost certain that url rewriting is working. Only problem is the address bar's address is shown with the old address.

What I meant to say is:

when i click the link
http://www.example.com/page-nine

will open the content of page
http://www.example.com/index.php?page=nine

but the address bar is displayed with the address of
http://www.example.com/index.php?page=nine
instead of the address as
http://www.example.com/page-nine

So is this the problem of the server?
Thanks in advance

jdMorgan

11:16 pm on Jul 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is likely an error in your code. You should use the 'internal rewrite' syntax, not the "external redirect" syntax.

Jim

Nilesh9

2:09 am on Jul 14, 2009 (gmt 0)

10+ Year Member



Thanks for replying so fast.

Here's the rewrite rule that I used.
RewriteRule ^page-([a-z0-9-]+)/?$ index.php?page=$1 [NC,L]

When I use the same rule in windows based XAMPP and it works fine but when I uploaded it in the server its not changing the address in the address bar.

So I'm confused whether its the problem of the server or not.

I really appreciate your help.

jdMorgan

2:18 am on Jul 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are like 99.9% of all Webmasters, you *do not want* the address bar to change to show your internal script filepath as a URL. It is ugly, hard to remember, and presents an open door to scripting exploits.

The rule you posted above is correct code to pass client requests for your SEO/friendly URLs to your script.

So, the problem is apparently on your XAMPP development system, and not on the server. A possible cause is another rewriterule that is doing a redirect after this URL is rewritten to the script filepath, or maybe you've got MultiViews enabled on your development system, and it is interfering with mod_rewrite.

Jim