This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » Developer » Remove index.php from the url
expandshrink

Remove index.php from the url

Remove index.php from the url

Thursday 18 April 2013 4:03:35 pm - 9 replies

Good evening

I just moved my site to another server, but something has gone bad.

I have a serious issue: I have to to insert index.php before any other string in my url. I used to call my page typing http://www.mysite.com/myarticle, but now I can reach the same result only typing http://www.mysite.com/index.php/myarticle.

This seems a very silly problem, but a very large amount of my links, expecially the ones that I have created by {"/myarticle"|ezurl} or via CMS pointing to eznode://1234,  are not pointing to the correct page!

Any hint?

 

Thanks

Thursday 18 April 2013 4:33:22 pm

Hi,

To remove index.php from url you need to have the right rewrite rules in htaccess (or virtual host) and you have to set the ForceVirtualHost setting in site.ini to true.

So compare your .htaccess between the old and the new system, there should be some differences.

Thursday 18 April 2013 4:41:06 pm

Quote from Ivo Lukač :

Hi,

To remove index.php from url you need to have the right rewrite rules in htaccess (or virtual host) and you have to set the ForceVirtualHost setting in site.ini to true.

So compare your .htaccess between the old and the new system, there should be some differences.

Good try... but unfortunately virtual hosts are identical! sad.gif Emoticon

<VirtualHost *:80>   
<Directory /var/www/provincia>       
    Options FollowSymLinks       
    AllowOverride Options   
</Directory>

<IfModule mod_php5.c>        
... something here ...
</IfModule>
DirectoryIndex index.php

<IfModule mod_headers.c>   
    <FilesMatch "\.(?i:p7m)$">     
        ForceType application/x-pkcs7-mime     
        Header set Content-Disposition attachment   
    </FilesMatch> 
</IfModule>
<IfModule mod_rewrite.c>       
    RewriteEngine On       
    RewriteRule content/treemenu/? /index_treemenu.php [L]       
    RewriteRule ^/var/storage/.* - [L]       
    RewriteRule ^/var/[^/]+/storage/.* - [L]       
    RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* - [L]       
    RewriteRule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]       
    RewriteRule ^/share/icons/.* - [L]       
    RewriteRule ^/extension/[^/]+/design/[^/]+/(stylesheets?|images?|javascript|flash|lib?)/.* - [L]
    Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]       
    RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]       
    RewriteRule ^/favicon\.ico - [L]       
    RewriteRule ^/robots\.txt - [L]       
    RewriteRule ^/sitemap\.xml - [L]
   
    # Uncomment the following lines when using popup style debug.
    RewriteRule ^/var/cache/debug\.html.* - [L]
   
    RewriteRule ^/var/[^/]+/cache/debug\.html.* - [L]       
    RewriteRule .* /index.php
</IfModule>
AcceptPathInfo On
</VirtualHost>

 

 

I can only add that this virtual host was created on a previous version of EzPublish. Now I have updated it... is that important?

 

Modified on Thursday 18 April 2013 4:42:20 pm by Simone Conti

Thursday 18 April 2013 5:32:00 pm

Maybe the mod_rewrite is not enabled happy.gif Emoticon first check this. And check the ForceVirtualHost setting too.

Thursday 18 April 2013 5:47:14 pm

mod rewrite is enabled, off course happy.gif Emoticon

I really don't know what ForceVirtualHost is... 

Thursday 18 April 2013 9:13:37 pm

Hello,

Have you try to purge cache ? Because eZ have ezurlalias caches.. If you're on dev server you could do something like that: (barbarian mode on)

 $php bin/php/ezcache.php --clear-all --purge

If this is the same result you could have a try with

 $php bin/php/updateniceurls.php -s your_siteaccess_admin

Cheers

Friday 19 April 2013 9:59:34 am

Quote from Philippe Vincent-Royol :

Hello,

Have you try to purge cache ? Because eZ have ezurlalias caches.. If you're on dev server you could do something like that: (barbarian mode on)

 $php bin/php/ezcache.php --clear-all --purge

If this is the same result you could have a try with

 $php bin/php/updateniceurls.php -s your_siteaccess_admin

Cheers

Hello,

I tried both your suggestions. The first one did not have any effect... I tried it several times before.

The second one... well seems not to be the right one. I executed this command

$php bin/php/updateniceurls.php -s gestione

where "gestione" is the name of my admin site access. But if I call www.mysite.com/gestione a 404 error appears, so I have to add index.php/

What about trying the same command with my client-side siteaccess? Is that safe? 

 

Thanks!

Friday 19 April 2013 10:23:32 am

Quote from Simone Conti :

mod rewrite is enabled, off course happy.gif Emoticon

I really don't know what ForceVirtualHost is... 

It's an ini setting to be found in site.ini - if it isn't set to [SiteAccessSettings] ForceVirtualHost=true it could be creating problems.

That said, I don't think mod_rewrite is actually on...

There are a couple of ways to check that - remove the <IfModule mod_rewrite.c>   and restart apache - if it fails then you know it's not enabled - or use something like this (don't forget to restart apache):

RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 1

To see where (and if) the rewrite rules are sending you.

Modified on Friday 19 April 2013 10:25:39 am by Steven E Bailey

Friday 26 April 2013 6:11:07 am

Are you sure the .htaccess file is being read and applied?

If AllowOverride is set to None at the server level, the .htaccess files won't be read.

It may also be that the server configuration architecture is different, so you will need to put the .htaccess settings in a different file.

You might want to check with the hosting company if you have one.

A quick test would be to put something invalid in the .htaccess file, like "crash here".  If the server still delivers pages, the .htaccess file is not being read.

Friday 24 May 2013 12:14:18 pm

There might be problem with your vitual host entry. Be sure that directory Index and rewrite rule is present.And restart your server.

DirectoryIndex index.php

<IfModule mod_rewrite.c>  

RewriteRule .* /index.php
</IfModule>

and let me know if it doesn't work.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from