You are here:  » Htaccess and relative links


Htaccess and relative links

Submitted by arthuc01 on Fri, 2006-02-10 11:02 in

Hi Dave

Just a quick note, alot of the links when using htaccess are still relative to the root so things like...

  if (file_exists(".htaccess"))
  {
    $merchant_href = "merchant/";
  }
  else
  {
    $merchant_href = "merchants.php";
  }

Should Be

  if (file_exists(".htaccess"))
  {
    $merchant_href = $config_baseHREF."merchant/";
  }
  else
  {
    $merchant_href = "merchants.php";
  }

Submitted by searley on Fri, 2006-02-10 11:12

I actually think that

if (file_exists(".htaccess"))

is not the best way of doing it, maybe a y/n in the config file..

the reason being, ever linus site i have has a .htaccess file in it, notrmally to control things like 404 errors, or for cgi overrides, doesnt mean i have the mod-rewrite in place!!

Submitted by arthuc01 on Fri, 2006-02-10 11:14

very good point hadn't thought about that - have been living in a mod_rewrite world for too long now :-)

Submitted by searley on Fri, 2006-02-10 11:20

not a problem with the server i put this script on, but some of the servers i have dont allow modrewrite via .htaccess

Submitted by support on Fri, 2006-02-10 12:10

Hi,

Agreed - i'll move this to a config setting rather than detecting whether .htaccess exists (and fix any missing $config_baseHREF's ;)

The reason I didn't do this in the first place is because I was worried that people would turn on search engine friendly URLs during installation without setting up the necessary settings in .htaccess.

As a compromise, what I will do is make it a config setting; and then perform a test in setup.php that will check for .htaccess if search engine friendly URLs have been enabled.