Jump to content

PHP, HTML and HTACCESS


jnroche

Recommended Posts

Shouldn't make any difference to loading time whether you use absolute or relative url's. Unless you have about 10 million links on your page, then all those extra bits of text to make up the absolute url will make your file size alot bigger. I shouldn't worry about it...and how is this got to do with the htaccess and url rewriting?:)

Link to comment
Share on other sites

I'd use relative paths wherever possible. Makes code smaller AND more portable (imagine you decide to change the domain name one day - wouldn't want to go over all links just to make that change, would you?).But yeah. What does this have to do with URL rewriting? If you're worried URL rewriting is going to slow down the loading of images, place them in a folder that doesn't get rewritten. That is, make sure your URL rewriting rule rever rewrite the URLs from that directory.

Link to comment
Share on other sites

Thanks for replying guys!I normally use relative paths for all links inside my pages. however, since i used htaccess to rewrite urls, my images does not load up. But if I change my relative paths to absolute it loads up! And changing my domain will really be a problem if i use absolute paths...how come that when i rewrite my urls, relative paths does not work anymore? or am i doing something wrong?

Link to comment
Share on other sites

Thanks for replying guys!I normally use relative paths for all links inside my pages. however, since i used htaccess to rewrite urls, my images does not load up. But if I change my relative paths to absolute it loads up! And changing my domain will really be a problem if i use absolute paths...how come that when i rewrite my urls, relative paths does not work anymore? or am i doing something wrong?
Try to write your paths relative to the document root. That is, use for example
/images/image1.jpg

instead of plain

images/image1.jpg

The latter can resolve to

http://www.mysite.com/file/images/image1.jpg

if the file was at

http://www.mysite.com/file/

Link to comment
Share on other sites

Try to write your paths relative to the document root. That is, use for example
/images/image1.jpg

instead of plain

images/image1.jpg

The latter can resolve to

http://www.mysite.com/file/images/image1.jpg

if the file was at

http://www.mysite.com/file/

It worked like a charm!Thanks so much man! really appreciate it. Seems there really is an issue with urls without the '/' sign when using htaccess, thats why it won't recognize paths without the preceeding '/'.Problem solved! Thanks again Gurus!
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...