Forum Moderators: phranque

Message Too Old, No Replies

renaming the URL in the address bar

         

krish1

6:30 am on Aug 7, 2012 (gmt 0)

10+ Year Member



Hi Everyone


whenever apache requests anything from www.xyz.com/v/blah.com/ma/www/oos
it should actualy request from there but on the url it should always show www.xyz.com/u/g/ins/pro

but on the address bar i want to display www.xyz.com

I have to do this for nearly 500 URLs,is this possible

Thanks

lucy24

7:39 am on Aug 7, 2012 (gmt 0)

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



All things are possible with Apache. Almost. But you have got your question backward.

A Rewrite can create a difference between what the address bar shows and where the page content really lives. BUT it does it by leaving the address alone and quietly fetching the content from elsewhere. The only way to change the address is to redirect.

There are, hm, at least a thousand earlier posts in this forum explaining how to do the Redirect-to-Rewrite two-step. Start reading earlier threads and you will soon have the boilerplate memorized.

500 URLs probably means some kind of php script to look up what content goes with what address.

www.xyz.com/v/blah.com/ma/www/oos
it should actualy request from there but on the url it should always show www.xyz.com/u/g/ins/pro

but on the address bar i want to display www.xyz.com

Uhm, uh, what's the difference between "on the url" and "on the address bar"? You can do two locations-- the visible url and the real filepath. You can't do three.

g1smd

7:59 am on Aug 7, 2012 (gmt 0)

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



On the pages of your site, link to the URL that you want users to "see" and "use". URLs are defined in links.

Set up a rewrite from the requested URL to the internal filepath that will deliver the content.

Set up a redirect so that when the old URL is requested, the browser is told to make a new request for the new URL.

Use a RewriteRule for the redirect (with a RewriteCond to check this was an external request) and another one for the rewrite.

URLs are used "out there" on the web. Filepaths are used "here" inside the server. They are not at all the same thing.

A redirect is a URL to URL translation.

A rewrite is a URL to internal filepath translation.