This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Install & configuration » howto remove 'index.php' in urls

howto remove 'index.php' in urls

howto remove 'index.php' in urls

Tuesday 11 November 2003 1:00:53 pm - 15 replies

Hi all,

I have read numerous accounts of people trying to remove the index.php and have followed all of the subsequent suggestions to no avail. So let me explain what i have:

I have ezPublish 3.2.2 installed into the root dir of my server. So that i can access it with All URLs work with the index.php, in it but I want to remove it.

my /settings/override/site.ini.append.php contains the following:



With this config i can access but not (it redirects me to the '/' root page)

The catch is that i donnot have access to httpd.conf and know that i cannot set any virtualhost directives.

But, do I really need to if it is installed to my root dir?

Also, in this configuration, I don't see there is any infomation to remove the 'index.php' part from the URL...

it's all very confusing :S

Any advice would very much appreciated.

Modified on Tuesday 11 November 2003 1:05:29 pm by Lachy Laycock

Tuesday 11 November 2003 1:38:48 pm

I have the same problem.
The only way you can fix it afaik is to put your rewrite rules in httpd.conf.
As soon as you put them into .htaccess, you are stuck with the index.php bit.

I have logged a bug report, but I doubt that it is high on anyones todo list.

My advice would be to ask your webserver admin/ISP/hosting provider/whatever to put the rewrite rules into your httpd.conf for you.

Tuesday 11 November 2003 3:14:17 pm

You need to have this RewriteRule in your httpd.conf:

RewriteRule !\.(gif|css|jpg|png|jar|js|html)$ /index.php


Wednesday 12 November 2003 6:04:06 am

You also need to have both mod_rewrite *and* mod_proxy compiled and enabled don't you so that you can use the RewriteRule parameter [P] instead of [R], thereby 'hiding' the index.php????


Wednesday 12 November 2003 6:50:01 am

Thanks for all your suggestions.

Given my limited access to Apache configurations (being on a shared server), I have decided that the best solution so far seems to be in using mod_rewrite (given no mod_proxy). I created the following rules that do the job i want to do:

RewriteRule !(^/?user/?.*$|^/?admin/?.*$|\.(gif|css|jpe?g|png|js|asf|avi|wmv|swf|xsl|jar|html))$ index.php

RewriteRule ^/?(user|admin)/?(.*)$ index.php/$1/$2

this allows me to have urls like:


The new issue becomes, how do i change the urls within the site?

Exisiting ones still work with the ezurl operator, like:

But using the ezroot operator is no good, eg:

So, I assume i should create a new operator to use with url_alias that prepends the SiteAccess name to the url_alias value.

This seems like quite a hassel for something that should be already configurable within the ini settings.

Can anyone think of a better, elegent solution to this hack?


Wednesday 12 November 2003 9:14:49 am

In response to myself:

I have created a temporary solution/hack that does the job:

In my .htaccess i have:

RewriteRule !(^/?user/?.*$|^/?admin/?.*$|\.(gif|css|jpe?g|png|js|asf|avi|wmv|swf|xsl|jar|html))$ index.php

RewriteRule ^/?(admin|user)/?(.*)$ index.php/$1/$2

This effectively removes the index.php from the URLs.

Next to remove the 'index.php' from the links within the templates i created a template operator called 'ezniceurl', this replaces the 'ezurl' operator. The code from the modify function in that class is:

function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )

$ini = eZINI::instance();
eZSys::init( $ini );

// This siteAccessName eg: 'user' or 'admin'
$siteAccessName = $GLOBALS['eZCurrentAccess']['name'];

// append a separator if needed
if(substr($siteAccessName,-1)!=eZSys::FileSeparator() and $operatorValue[0]!=eZSys::FileSeparator())
$siteAccessName .= eZSys::FileSeparator();

$operatorValue = eZSys::wwwDir() .
$siteAccessName .

(To find out how to make an operator check out the ones in the contributions section)

Very simple. It just appends the current siteAccess name to the ezroot value.

I am still not convinced this is a usefull solution, but for time being I am going to run with it, for lack of a better solution.


Modified on Wednesday 12 November 2003 9:17:27 am by Lachy Laycock

Sunday 23 November 2003 8:40:33 pm

Has anyone managed to to this - remove the 'index.php' part of the URL?

I've almost had-it with this!!!! I need to sort it out as I have recently purchased a license for the OE and cannot get it to work.......

I've tried all the suggestions through out this forum with no success - only frustrations and wasted time!!!!

Modified on Sunday 23 November 2003 8:41:25 pm by Simion Ward

Monday 24 November 2003 2:14:15 am

My last reply to this thread outline the steps for removing the 'index.php' in the URL. Have you tried this? It is working for me.

Modified on Monday 24 November 2003 2:14:44 am by Lachy Laycock

Monday 24 November 2003 9:49:19 am

Well, well ,well...... It works !!!!! Ez - you should take this 'hack' and .htaccess rewrite rule into consideration as it works perfectly for websites that are on shared servers with limitedd access to config files.

It also allows the Online editor to work correctly.


Monday 24 November 2003 10:44:02 am

I am glad you got it to work. But i do need to point out some of the limitations with this 'hack'.

Depending on your config, in order to truely remove all instances you will need to do a search-&-replace for all template in your dir and the design/standard dir. This creates some problems in the admin section.

In particular, the redirects after objects removal, submitting a newly published item etc etc break.... and I have not worked out how to fix this yet. This is something I am just living with.

My recommendation is to leave the standard directory as is and suffice with the index.php in your admin section and just override any instances of ezurl on your frontend that are coming from the design/standard/templates dir.

I do agree that this was way to hard to do. It should be something very simply configurable in the settings/* dir - maybe it is and no-one has pointed that out yet...

Monday 24 November 2003 12:14:25 pm


Thanks for that, I was just starting to consider the adverse effects the hack may have. Surely the "ezUrl" datatype could be modified directly. This would then cascade through the entire system, reducing work needed to 'find & replace'?

Monday 24 November 2003 1:02:59 pm

Indeed, it possible could be a better solution. But I felt queezy at the thought of hacking the files under kernel/ and or lib/ made me think twice. If were to do that then upgradeing version would be a big and I don't know how deep rabbit hole goes in terms of interdependancy goes with these things...

What would be nice is if the ez team slated some patches for the related kernel+libs files for a future release to support this.

I guess if some-one should propose a patch it's chances of adoption would be much higher...

But who knows how many ppl even consider this important? you + me = 2...

Sunday 08 February 2004 8:03:36 pm

I'm just living with it, what's so bad about the "index.php" bit anyway?

Friday 12 May 2006 7:35:17 pm

@Lachy: I tried to implement your solution but need some more guidance. Can you maybe send me your files, or point me to instrauction on where to paste your code?

Saturday 13 May 2006 4:45:49 pm

To remove index.php from ezurl generated urls put the following in your site.ini.append.php:


Then you can use mod_rewrite rules in .htaccess to prepend all urls with index.php? as described above.
There's no need to hack any kernel files.

Wednesday 17 May 2006 6:36:24 pm

I have placed the code above in my siteaccess override and activated the rewrite rules, but the links in the pages produced by eZ Publish still show the index.php part.

I am now going through all my templates to change the ezurl operator into ezroot, which is a lot of work.


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from