[3.4, PHP as CGI]: removing "/index.php?/" URL part

Author Message

Yaroslav Markin

Friday 25 June 2004 4:18:43 am

I am running 3.4 with CGI patch, so all URL's look like:

/index.php?node1/node2/mynode

How do I remove "index.php?" from URLs? Running VHost mode.

Now i have default .htaccess:

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

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

RewriteEngine On
RewriteRule !\.(gif|jpe?g|png|css|js|html)|var(.+)storage.pdf(.+)\.pdf$ index.php

DirectoryIndex index.php 

Andres Attemann

Friday 13 August 2004 3:09:01 pm

Just tried today to play with ez publish 3.4.1 (version doesn't matter, really), PHP-CGI, NVH mode.
It is quite broken (search is not working, admin interface is not working, etc) - but i've got rid of the /index.php? part of the url without patching ezPublish sources :)
Procedure:
1. unpack/install in e.g. ~/www/ezp (I assume ~/www is your docroot)
as normal (on PHP-CGI system). Assume siteaccess is "plain"
2. Test it's working as domain.com/ezp/index.php?/plain
3. create following .htaccess in ~/www

Options All -Indexes ExecCGI
DirectoryIndex plain

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /index.cgi

4. Make sure there is NO file named ~/www/plain
5. Create ~/www/index.cgi

#!/bin/sh

cd ~/www/ezp
# Execute index.php, tidy output, strip /ezp/index.php? part, replace &eZSESSID*" with "
php index.php | tidy -q | sed "s/\/ezp\/index.php?//g;s/\&amp;eZSESSID.*\"/\"/g" > ~/tmp/out.html

#Print headers
echo "Content-Type: text/html"
echo -n "Content-Length: "
stat ~/tmp/out.html | grep Size | awk '{ print $2 }'
echo ""
cat ~/tmp/out.html

6. Test it. Should work

PS
Make sure there IS ~/tmp dir or change script to use /tmp

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 19 2025 00:57:00
Script start
Timing: Jan 19 2025 00:57:00
Module start 'layout'
Timing: Jan 19 2025 00:57:00
Module start 'content'
Timing: Jan 19 2025 00:57:00
Module end 'content'
Timing: Jan 19 2025 00:57:00
Script end

Main resources:

Total runtime0.5807 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0044 589.4063152.6563
Module start 'layout' 0.00440.0032 742.062539.4922
Module start 'content' 0.00760.5713 781.5547464.4297
Module end 'content' 0.57890.0017 1,245.98448.1250
Script end 0.5807  1,254.1094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.5528160.0002
Check MTime0.00140.2387160.0001
Mysql Total
Database connection0.00060.100910.0006
Mysqli_queries0.534892.0990540.0099
Looping result0.00050.0911520.0000
Template Total0.544493.720.2722
Template load0.00200.348720.0010
Template processing0.542393.389420.2712
Template load and register function0.00030.048710.0003
states
state_id_array0.00110.193910.0011
state_identifier_array0.00100.178820.0005
Override
Cache load0.00160.2781230.0001
Sytem overhead
Fetch class attribute can translate value0.00090.150220.0004
Fetch class attribute name0.00120.214720.0006
XML
Image XML parsing0.00020.041720.0001
class_abstraction
Instantiating content class attribute0.00000.002320.0000
General
dbfile0.00190.3245100.0002
String conversion0.00000.004340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs