[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.