How to use .htaccess to remove index.php from URL?

Author Message

Eivind Marienborg

Friday 13 November 2009 1:35:58 am

Greetings!

I've spent hours trying the different approaches to removing index.php from the URL of the site, but now I give up, and hope someone braver and stronger than me might help.

I'm in a hosted environment, and don't have access to the httpd.conf (why doesn't the installation documentation offer help for this?).

I've added the ForceVirutalHost=true to override/site.ini.append.php, and copied .htaccess_root to .htaccess.

When accessing the root page everything's fine. But when trying to access subpages with index.php in the URL, I get an "Access forbidden" error.

I would greatly appriciate any help - either being pointed in the direction of a tutorial or documentation page, or suggestions on what to try.

Gaetano Giunta

Friday 13 November 2009 4:10:06 am

If you're using the stock .htaccess file from eZP install, you need to comment out the first 2 FilesMatch directives to make it work in 'vhost mode':

#<FilesMatch ".">
#order allow,deny
#deny from all
#</FilesMatch>

#<FilesMatch
"(^index\.php|favicon\.ico|index_treemenu\.php|\.(gif|jpe?g?|png|css|js|swf|html?)|var(.+)storage.pdf(.+)\.pdf)$">
#order allow,deny
#allow from all
#</FilesMatch>

This should have the exact same effect as uncommenting the 3rd configuration block, which is recommended by the comments within the .htaccess file itself...

Principal Consultant International Business
Member of the Community Project Board

Eivind Marienborg

Friday 13 November 2009 6:35:19 am

Thanks for your reply. Doing like you say removes the error messages, but if I try to access any page (without index.php in the URL), the home/root page is displayed.

So, one step forward, but I'm still not quite where I want to be.. :)

Rakshit Patel

Wednesday 23 December 2009 11:49:30 pm

Here is a solution to rmove index.,php from URLs. This works for me.

http://bit.ly/4nz3nZ

Rakshit Patel.
http://www.programmingfacts.com/

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 00:56:01
Script start
Timing: Jan 30 2025 00:56:01
Module start 'layout'
Timing: Jan 30 2025 00:56:01
Module start 'content'
Timing: Jan 30 2025 00:56:01
Module end 'content'
Timing: Jan 30 2025 00:56:01
Script end

Main resources:

Total runtime0.0163 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.3828151.2422
Module start 'layout' 0.00450.0025 739.625036.7109
Module start 'content' 0.00700.0070 776.335990.3438
Module end 'content' 0.01400.0022 866.679733.9922
Script end 0.0162  900.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002515.5059140.0002
Check MTime0.00116.8676140.0001
Mysql Total
Database connection0.00074.467410.0007
Mysqli_queries0.002213.809930.0007
Looping result0.00000.074810.0000
Template Total0.00148.610.0014
Template load0.00116.707610.0011
Template processing0.00031.857410.0003
Override
Cache load0.00074.467410.0007
General
dbfile0.001911.544780.0002
String conversion0.00000.029340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs