Forum Moderators: phranque

Message Too Old, No Replies

htaccess slash

         

jameschambers

1:03 pm on Sep 8, 2006 (gmt 0)

10+ Year Member



I'm having some problems with the links on my local testing site.

On my remote server the links are all in the format src="/somefile.php" and they all work fine. However, I have recently set up my mac as a server so i can test my sites locally, and it doesn't like this link format. The links will work if i remove the slash manually, but there are a lot of them and then i would have to add them again before uploading to the remote server.

I'm sure there must be a way of doing this with .htaccess, but I can't seem to figure it out.

Any help very gratefully received

jdMorgan

2:55 pm on Sep 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is the browser, not the server, that resolves page- or server-relative links. Take a look at your server error log and access log to see what URL the browser is requesting, and what filepath the server tries to access as a result.

Jim

coopster

3:34 pm on Sep 8, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You may also want to check and make sure you don't have DirectorySlash [httpd.apache.org] off.

And welcome to WebmasterWorld, jameschambers.

penders

7:11 pm on Sep 8, 2006 (gmt 0)

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



src="/somefile.php"

Your 'somefile.php' is in the same directory as the current file, which is the root directory of your webspace. Do you have the DocumentRoot (or the server root directory) set correctly? Are you viewing your files through the webserver and not directly on your machine? ... just a thought.

jameschambers

11:24 am on Sep 9, 2006 (gmt 0)

10+ Year Member



Hi everyone, thanks for your replies.

Still having problems, I'm pretty new to apache so forgive me if I'm a bit slow...

I see your point about the document root but I can't see how to change it without messing up my whole server. I am running apache on my own machine, and the only links I have got to work have been rewriterules with the rewritebase set to /~jameschambers/MySite/.

However I can't see how to implement this into the whole site, so all the links will be served like this.

Thanks Again