Forums / Setup & design / Getting rid of the ? sign in the "index.php?"

Getting rid of the ? sign in the "index.php?"

Author Message

Jorge estévez

Wednesday 15 September 2010 8:10:31 am

Hello,

 

I have hosted a new ezpublish site and the url comes out like this

 

http://www.site.com/index.php?/esl/Mi-Empleo

 

Having the ? sign is giving me some problems in the way the site works, search does not work at all (404 error) and other submission buttons also reports a 404 error.

 

I once saw some .htaccess code that got rid of the ? of the site and the search worked properly

 

Can someone help please.

 

Thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gabriel Finkelstein

Wednesday 15 September 2010 9:53:04 am

If you have access to Apache config, read this:

http://ez.no/doc/ez_publish/technical_manual/4_x/installation/virtual_host_setup

If you only have access to .htaccess, just put in it the RewriteEngine On and the RewriteRules (Look at the second comment from the above link).

Jorge estévez

Wednesday 15 September 2010 11:19:51 am

Thanks.

In have access to the .htaccess, so I can modify it...

I can add RewriteEngine On

But when it comes to selecting something (RewriteRules) from the second comment of the link you gave me... cannot tell what to add to my .htaccess. Can you be more specific, I just need something to get rid of the "?", it seems there is a lot of stuff there that handles other issues (wich I do not understand, sorry).

thanks again!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gaetano Giunta

Wednesday 15 September 2010 11:38:47 am

I'm afraid it might be a slightly different case here: rewrite rules are needed in general to remove the 'index.php' part from the url; the ? in the urls generated by eZ is there because it detects that you are running php in cgi or fastcgi mode (and there is a known bug that search will not work in cgi mode, you can look it up in wit).

Could you switch from chi mode to mod_php?

Principal Consultant International Business
Member of the Community Project Board

Jorge estévez

Wednesday 15 September 2010 12:09:18 pm

Thanks

Switching from chi mode to mod_php: How can I do that, I do not know if I can change it (quite lost with this)

thanks again!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Wednesday 15 September 2010 1:14:32 pm

Me again!

At the site users are allowed to create contents, once a user clicks the button to create a content it also gives an error and 404 error page apears... Is this also because of the cgi mode?

I cannot access the httpd.conf file of apache at the hosting service, I can only modify the .htaccess file at the location of the site... I suppose this will not be a solution...

Any other workaround?

thanks!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Romeo Antony

Thursday 16 September 2010 2:37:42 am

Hi Jorge,

I have also the same issue. I am running php in fast cgi mode. Bez of fast cgi or cgi , in url, after index.php a question mark will be genered by ezpublish. Also search will not work as Gaetano told.

What I did is I have changed the get method to post in search templates. If site visitors allowed to create contents by clicking on some button, check the templates to see how the data is managed(by post or get method) , if neccessary change it into post.

Otherwise only solution is to try the virtualhost setup in your .htaccess . I am sorry tosay that I do not have any idea to set up rewrite rules in .htaccess if you don't hav access to httpd.conf. Hope some experienced hands may help u.

Regards

Romeo

Gaetano Giunta

Thursday 16 September 2010 10:12:42 am

If you cannot change httpd.cong because of hosting mode, there are little chances that you will be able to swicth from fastcgi to mod_php. Try asking the hosting provider and see what you get as an answer.

The only solution is, afaik, to move to vhost mode. Access to .htaccess file is enough for that.

You will need to:

. set up an .htaccess file at the root of ezP that redirects all requests (except those to static files) to index.php - sorry, but a 'simple rule to remove the ?' will not do it

. in ezp config file site.ini, set ForceVirtualHost=true

Principal Consultant International Business
Member of the Community Project Board

Jorge estévez

Thursday 16 September 2010 10:44:44 am

Romeo,

Thanks for the tip,

 

The search uses Get so I will change it to Post (in the past I remember doing such a change for a web site and worked ok)

 

But the creation of content uses Post (creation of two custom objects and other ez´s built in objects). Should I change them to GET instead of Post.

 

If you get your hands on .htaccess code that can handle this whole mess please let me know ASAP, it seems a better solution to handle this issue.

 

Thanks again

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Thursday 16 September 2010 10:50:15 am

Gaetano,

I cannot change httpd.cong, No way, My hosting provider will not make changes at all...

Regarding

--------

. set up an .htaccess file at the root of ezP that redirects all requests (except those to static files) to index.php - sorry, but a 'simple rule to remove the ?' will not do it

 

 

-------

It is not simple for me, sorry the code that makes the .htaccess do what you tell me is far away from my knowledge. If you could write down the code that should solve this issue and make the site work please do so, as the site is already finished and waiting to run propperly due to this mess.

I will be in debt,

thanks!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gabriel Finkelstein

Thursday 16 September 2010 11:12:25 am

Try putting this in your .htaccess:

<span class="line">DirectoryIndex index.php</span>  <span class="line"></span>
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 .* /index.php<span class="line"></span>

I haven't tried it, but it should work.

Jorge estévez

Thursday 16 September 2010 1:03:22 pm

Thanks Gabriel I will try it...

Be back soon to tell you...

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Friday 17 September 2010 1:33:41 am

Gabriel,

Thi is the whole .htaccess,

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 .* /index.php

The following lines where already there (added automatically by the hosting service)

The result page gave me this:

500 - Internal Server Error

This is a temporary server error.

Please try to reload the webpage later.

If you are the webmaster of this site please log in to Cpanel and check the Error Logs. You will find the exact reason for this error there.

Common reasons for this error are:

  • Incorrect file/directory permissions: Above 755. In order files to be processed by the webserver, their permissions have to be equal or below 755. You can update file permissions with a FTP client or through cPanel's File Manager.
  • Incorrect Apache directives inside .htaccess file. Make sure you have not specified unsupported directives inside the local .htaccess file. Such include PHP settings and Apache module settings.

-----------------------

Everything is 755. Any tips?

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gabriel Finkelstein

Friday 17 September 2010 9:05:35 am

I think it's because of the line

 Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]

Change "Rewriterule" to "RewriteRule".

Jorge estévez

Friday 17 September 2010 2:06:43 pm

Thanks,

Went and changed "Rewriterule" to "RewriteRule".

Still getting same errors. I then checked out the error log file and found:

[Fri Sep 17 15:57:58 2010] [alert] [client 200.55.128.21] /home/cubaempl/public_html/.htaccess: RewriteRule: bad flag delimiters
[Fri Sep 17 15:57:54 2010] [alert] [client 200.55.128.21] /home/cubaempl/public_html/.htaccess: RewriteRule: bad flag delimiters

There´s something else wrong.

This is the whole "code" of the .htaccess:

-----------------------------------

RewriteEngine on
RewriteCond %{HTTP_HOST} ^bolsaempleocuba.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.bolsaempleocuba.com$
RewriteRule ^/?$ "http\:\/\/www\.pincha\-aqui\.com" [R=301,L]
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 .* /index.php

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gabriel Finkelstein

Friday 17 September 2010 3:16:55 pm

Ok, try this code instead:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^bolsaempleocuba.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.bolsaempleocuba.com$
RewriteRule ^/?$ "http\:\/\/www\.pincha\-aqui\.com" [R=301,L]
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 .* index.php 

There was an extra space in line 11, and I removed the slash from the last line.

Jorge estévez

Friday 17 September 2010 4:02:27 pm

Trying...

It's NOT giving the error page, but the page displays strange, as if no CSS loads at all (the code of the pages seems right with the call to all CSS)

Resume: It displays as plain text all the top menu items, and all the left menu items, then the copyright (all displayed in one column) and NO CONTENT AT ALL

I will leave it as it is: please take a look at www.pincha-aqui.com

Almost there, thanks Gabriel

Thanks again

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gabriel Finkelstein

Friday 17 September 2010 7:23:00 pm

Ok, lets try with this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^bolsaempleocuba.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.bolsaempleocuba.com$
RewriteRule ^/?$ "http\:\/\/www\.pincha\-aqui\.com" [R=301,L]
RewriteRule index_treemenu.php - [L]
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 .* index.php

Jorge estévez

Friday 17 September 2010 11:21:39 pm

The site can be seen now...

I have tried the search but it still gives me an error page...

When a user tries to create an object it always sends me to the home page

Visit the page again and try the search...

Thanks again!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gaetano Giunta

Saturday 18 September 2010 7:20:53 am

You still need to:

- force eZP to generate 'clean' urls by making it think he is running in vhost mode: please change your site.ini.append.php config and add ForceVirtualHost=true in the SiteSettings block

- clear caches

- look at the url generated by the system for e.g. the 'login' link at the top of the page. It should be: http://www.pincha-aqui.com/user/login and not http://www.pincha-aqui.com/index.php?/esl/user/login

ps: some other stuff

- please set a TITLE element in your html head seaction

- wtf is happening with the js alert when I right click on the links in the top menu?

Principal Consultant International Business
Member of the Community Project Board