The rewrite is pointing to a different location... pls help

New to mod_rewrite? This is a good place to start.

The rewrite is pointing to a different location... pls help

Postby ash » Thu Jun 18, 2009 7:33 am

Hi all,

I am very new to the rewrite but am trying to get a re-direction as follows:

http://www.mysite.com/Collections/SpringSummer2009/LookBook

to go to

http://www.mysite.com/collections-spring09-lb.php

I have added the following entry in the htaccess


RewriteEngine on
RewriteBase /
RewriteRule ^Collections/SpringSummer2009/LookBook$ /collection-spring09-lb.php


but for some reason it is changing the root to another sub-directory and as a result the images and includes are not loading.

Your help in this would be most appreciated.

Thanks in advance
ash
 
Posts: 3
Joined: Thu Jun 18, 2009 7:25 am

Postby richardk » Thu Jun 18, 2009 11:38 am

FAQ: Relative paths to images, JavaScript, CSS and other external/linked files are broken. The easiest solution is probably the HTML <base> element.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby ash » Sat Jun 20, 2009 1:44 pm

Hi Richard,

Thank you for your response. I have tried this and it does work to some extent with all the images and include files however, what I am having a serious problem with is the SQL connection file which are defined as

../../SQLconnect.inc.php

in the config.inc.php file of the site. There is no way to implement a change to the relative paths of these files without having an effect on all the files on the site.

Do you think that there are any other options I can explore apart from re-coding the paths in PHP.

Many thanks.
ash
 
Posts: 3
Joined: Thu Jun 18, 2009 7:25 am

Postby richardk » Sun Jun 21, 2009 9:57 am

Mod_rewrite and the URL should not affect internal PHP include()s as they are relative to the actual file whatever the URL is and are requested through the servers filesystem not the through Apache.

Are you sure this is the problem?
Are you using PHP with CGI?

I don't think there's any mod_rewrite fix for this. A PHP base constant would be best.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 85 guests

cron