Forums / Install & configuration / How to use .htaccess to remove index.php from URL?

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/

eZ debug

Timing: Jan 29 2025 13:37:45
Script start
Timing: Jan 29 2025 13:37:45
Module start 'content'
Timing: Jan 29 2025 13:37:45
Module end 'content'
Timing: Jan 29 2025 13:37:45
Script end

Main resources:

Total runtime0.0161 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.1797180.8047
Module start 'content' 0.00580.0066 768.984494.1016
Module end 'content' 0.01240.0037 863.085974.7031
Script end 0.0161  937.7891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.001911.7582120.0002
Check MTime0.00095.5457120.0001
Mysql Total
Database connection0.00084.886310.0008
Mysqli_queries0.002817.141340.0007
Looping result0.00000.137520.0000
Template Total0.003420.810.0034
Template load0.00084.917410.0008
Template processing0.002615.823910.0026
Override
Cache load0.00053.168310.0005
General
dbfile0.00148.8367100.0001
String conversion0.00000.035530.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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