Forums / Install & configuration / Removing index.php from url in nVH setup

Removing index.php from url in nVH setup

Author Message

Tomek Klaudel

Thursday 08 January 2004 1:21:42 am

My isp give me acces to mod_rewrite, but i can't put rewrite rulest into httpd.conf. I have it in .htaccess, so normally i has index.php in url.

I found that when i change lib/ezutils/classes/ezsys.php :

// Fallback... Finding the paths above failed, so $_SERVER['PHP_SELF'] is not set right.
if ( $siteDir == "./" )
$phpSelf = $requestURI;

to

// Fallback... Finding the paths above failed, so $_SERVER['PHP_SELF'] is not set right.
// if ( $siteDir == "./" )
$phpSelf = $requestURI;

(only comment "if ( $siteDir == "./" )" )

then everything working ok.
(I using Apache 3.X and ezP 3.2-3)

Best
Tomek

James Packham

Tuesday 04 May 2004 8:51:14 am

Nice one! I've spent ages looking for this solution (i.e. over a month) I don't know how but I've always used the wrong keywords I guess (things like "non virtual host", "get rid of index.php", "htaccess settings" etc).

I confirm that it also works in 3.3-4.

Regards,

James

Joel Hardi

Thursday 13 May 2004 12:15:51 pm

I'll also confirm this works ... but you can do the same thing without hacking core /lib code.

This is exactly what the ezroot operator is for. Just use ezroot instead of ezurl in all templates, i.e. <a href={"url"|ezroot}>

And be sure to override the default datatype template for <link> tags so links from within content work as well:

Override:

/design/standard/templates/content/datatype/view/ezxmltags/link.tpl

and change:

<a href={$href|ezurl} {section show=$target}target="{$target}"{/section}>{$content}</a>

to

<a href={$href|ezroot} {section show=$target}target="{$target}"{/section}>{$content}</a>