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

[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

eZ debug

Timing: Jan 18 2025 22:13:56
Script start
Timing: Jan 18 2025 22:13:56
Module start 'content'
Timing: Jan 18 2025 22:13:56
Module end 'content'
Timing: Jan 18 2025 22:13:57
Script end

Main resources:

Total runtime0.6992 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 587.9453180.8047
Module start 'content' 0.00590.5508 768.7500469.5391
Module end 'content' 0.55660.1425 1,238.2891333.4922
Script end 0.6991  1,571.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.5942210.0002
Check MTime0.00160.2249210.0001
Mysql Total
Database connection0.00050.076810.0005
Mysqli_queries0.632590.45841910.0033
Looping result0.00250.36371890.0000
Template Total0.670295.820.3351
Template load0.00200.286620.0010
Template processing0.668195.558620.3341
Template load and register function0.00010.020910.0001
states
state_id_array0.00090.124910.0009
state_identifier_array0.00080.115620.0004
Override
Cache load0.00170.2371230.0001
Sytem overhead
Fetch class attribute can translate value0.00130.181530.0004
Fetch class attribute name0.00090.126220.0004
XML
Image XML parsing0.00050.074530.0002
class_abstraction
Instantiating content class attribute0.00000.000920.0000
General
dbfile0.00440.6257210.0002
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs