Jump to content

Rewritten URL is showing the new URL in the browser


davestewart

Recommended Posts

Hi there,

 

I admit, I'm no expert on mod htaccess, in fact I normally use snippets gathered together to make my own Frankenstein's monster of an htaccess. So my question, which I suspect may be based on false assumptions is this:

 

I would like to rewrite "tunes" to "files/music", which I am doing as follows:

 

RewriteEngine On
RewriteBase /
RewriteRule ^tunes/?$		files/music [PT,L]

 

I was under the impression that this happened internally to the server, and the user would see "tunes" in the URL bar, but Apache would serve the default file in "files/music".

 

However, it looks as if the request is being completely redirected and the page served is "files/music".

 

Is it possible to do what I think it should be doing, or am I just misinformed?

 

Thanks,

Dave

 

 

lol, set the images and stuff on the page to search from the main directory on..

 

for example instead of:

 

main.jpg

^^ that will point the file to http://whatever.com/path/to/phpfile/main.jpg

use

 

/main.jpg

^^ that will point the file to http://whatever.com/main.jpg

 

understand?

Ah no - that's the PROBLEM!

 

The rewritten URL "tunes" is not being reflected in the links in the page, which are all relative.

 

.htaccess rewrite:

Realpath: /files/music/

RewritePath: /tunes/

 

Page URL:

www.domain.com/tunes/

 

Page links:

Link href: ./some-tune.mp3

Supposed file path: www.domain.com/tunes/some-tune.mp3

Actual file path: www.domain.com/some-tune.mp3

 

So for some reason the "tunes" part of the rewrite is not being reflected in the page links, even though they are relative and the page is showing "tunes" quite happily.

 

Any ideas?

 

Thanks,

Dave

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.