[SOLVED] 3.10.0 ezurl()|nice url - how to do it?

Author Message

Bernd Winkelmann

Sunday 04 November 2007 9:41:23 am

i have reading that in virtualhost environment using host access method all urls made by ezurl() are made as "nice url"

http://ez.no/doc/ez_publish/technical_manual/3_10/reference/template_operators/urls/ezurl

i tested this and the result are url's like this www.my_site.com/index.php?/path/to/site

in a older tread was a statement that is necessary to set ForceVirtualHost=true in site.ini overwrite.

so i tried that, and after this change the urls are ok but i doesn't become access to my sites (403 forbidden).

what must i do to become the access to my sites in this case?
are where other settings?

that can i do - i want to have "nice url's" without index.php? and i doesn't want to change all templates using ezroot. (http://ez.no/ezpublish/documentation/customization/tips_tricks/creating_nice_urls)

a problem seems that i have in my url the question mark after index.php - and i doesn't understand why. somebody told me that is because i'm using php as cgi module?

thanks for helpful tips
bernd

Bernd Winkelmann

Tuesday 06 November 2007 2:52:57 am

I have solved the problem - following i will describing what i have done.

1.my environment:
- sheared hosting server (packages are a nice low budget recommendation for users in germany -> http://www.webhosting-franken.de)
- no access to serverconfig (httpd.conf) so the virtual host configuration must be done by using .htaccess
- but i have access to the php.ini - so i have done the php setting part of vh configuration in php.ini
- Apache 2.2
- 4.4.7-0.dotdeb.1 - (as fastcgi module)
- ezPublish 3.10.0 installed with host access mode
- ForceVirtualHost=true (site.ini overwrite) default is false

2. my .htaccess in ezPublish installation root

Options +FollowSymlinks 

DirectoryIndex index.php

RewriteEngine On
RewriteBase /

# to avoid double entries in searchengine indexes
RewriteCond %{HTTP_HOST} ^(my_domain\.de)$
RewriteRule ^(.*)$ http://www.my_domain.de/$1 [redirect=permanent,last]

# to use WebDAV
RewriteCond %{HTTP_HOST} ^(webdav\..*)$
RewriteRule ^(.*)$ webdav.php [L]

# to use SOAP
RewriteCond %{HTTP_HOST} ^(soap\..*)$
RewriteRule ^(.*)$ soap.php [L]

# swiching for this cases the frontcontoller access
RewriteRule ^robots\.txt$  - [L]
RewriteRule ^favicon\.ico$ - [L]
RewriteRule ^sitemap\.xml - [L]
Rewriterule ^var/storage/.*$ - [L]
Rewriterule ^var/[^/]+/storage/.*$ - [L]
RewriteRule ^var/cache/texttoimage/.*$ - [L]
RewriteRule ^var/[^/]+/cache/texttoimage/.*$ - [L]
Rewriterule ^design/[^/]+/(stylesheets|images|javascript)/.*$ - [L]
Rewriterule ^share/icons/.*$ - [L]
Rewriterule ^extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.*$ - [L]
Rewriterule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.*$ - [L]
RewriteRule ^packages/styles/.+/thumbnail/.*$ - [L]
 # Uncomment the following lines when using popup style debug. 
 # RewriteRule ^/var/cache/debug\.html.* - [L] 
 # RewriteRule ^/var/[^/]+/cache/debug\.html.* - [L] 

# for use of dynamicTreemenu
RewriteRule ^content/treemenu/.*$ index_treemenu.php [L]

# directing all other requests to the frontcontroller 
RewriteRule .* index.php

3. (changed) php.ini settings:

safe_mode Off
register_globals Off
php_value magic_quotes_gpc Off
php_value magic_quotes_runtime Off
php_value allow_call_time_pass_reference Off

now system runs in a identical virtual Host environment like it was described in manual
http://ez.no/doc/ez_publish/technical_manual/3_10/installation/virtual_host_setup

4. the problem

although the system now is producing nice-url's in this style:

www.my_site.com/path/to/site

(before "ForceVirtualHost=true" was www.my_site.com/index.php?/path/to/site - the question mark results when using php as cgi module)

i doesn't become access to my sites using this url's (serversite 403 forbidden)

it seems that for a little moment was dispayed the site title before comes the 403.

5. my solution

so i made this hack in my .htaccess before rewriting

<FilesMatch "([^.+])$">
order allow,deny
allow from all
</FilesMatch>

now are all sites are accessible - system is running fine

but i haven't not a spoor of understanding for the problem itself and for eventual other effects of this hack.

if somebody can give me tips for a other way of solution or a qualified opinion, i would be happy :-)

thanx
bernd

Nehal Rupani

Wednesday 24 September 2008 2:37:59 am

Hi Bernd,

I running my site under shared domain and got same problem like you have access to .htaccess and need to control virtual host with .htaccess file. i just wanted to know is it possible to set up virtual host using .htaccess file. and also could higlight file in which i need replace operator |ezurl to |ezroot.

Thanks,
Nehal Rupani

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 21:42:52
Script start
Timing: Jan 30 2025 21:42:52
Module start 'layout'
Timing: Jan 30 2025 21:42:52
Module start 'content'
Timing: Jan 30 2025 21:42:52
Module end 'content'
Timing: Jan 30 2025 21:42:52
Script end

Main resources:

Total runtime0.0218 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0043 588.3672151.2266
Module start 'layout' 0.00430.0036 739.5938220.7188
Module start 'content' 0.00790.0124 960.31251,001.8828
Module end 'content' 0.02030.0015 1,962.195333.9922
Script end 0.0218  1,996.1875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002712.4194140.0002
Check MTime0.00104.7165140.0001
Mysql Total
Database connection0.00062.974410.0006
Mysqli_queries0.00177.799230.0006
Looping result0.00000.151010.0000
Template Total0.00104.610.0010
Template load0.00083.533610.0008
Template processing0.00021.077910.0002
Override
Cache load0.00052.478610.0005
General
dbfile0.00115.155380.0001
String conversion0.00000.038340.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