problems getting nice browser url using redirect/rewriterule
Currently I use a .htaccess redirect to send a (nice) url /offices/london/whatever to my scr开发者_开发知识库ipt (nasty url) /db/db.pl?offices-london-whatever
i want the browser url to be nice, with the 301 redirect it isn't so i tried with the RewriteRule but the browser url is still the nasty one.
e.g. RewriteRule Offices/London/(.*)$ /db/db.pl?Offices-London-$1 [NC]
it all navigates, i get the pages i want with either method, but i want the nice url not the nasty one for both the user browser and SEO. presently i only get the nasty url
any clues what i am doing wrong?
Let's assume the following:
RewriteRule ^/Offices/London/(.*)$ /db/db.pl?Offices-London-$1 [L,NC]
This makes your page accessible through www.yourdomain.com/offices/london. So you can just use that URL in your browser. As for SEO the crawlers will see you are using that URL in your links and will index it.
Remember that you can always use the other URL (the nasty one) aswell, just dont use it (except for testing ofcourse).
ok, thanks for that
the problem is not one of 'accessing' the script, that all works fine, it is of getting the browser address bar to NOT display the ugly path/url, which happens with the example above.
as for the SEO, it is not the case, google is currently displaying the ugly url.
by reading through http://www.webmasterworld.com/forum92/6079.htm (and www.askapache.com/htaccess/mod_rewrite-basic-examples.html) i am slowly getting there, with two rewrites and a cond, but i have been lazy in my perl and the relative paths are screwed, so got to do some more on it.
for now though, i got to do some other pesky customer things for a while.
will post my full solution here shortly!!!
精彩评论