This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » Installation and setup » shared host root ready .htaccess
shared host root ready .htaccess [message #57664] Sat, 02 August 2008 13:16 Go to next message
scott7  is currently offline scott7
Messages: 86
Registered: December 2007
Location: Dresden, Germany
Member
I guess many have tried to install symfony on a shared host. For mine i had to change the core files a little to get it running. The much bigger problem is the rewrite directives. I hardly can contain my rage on how lunatic this mod_rewrite is! I've been doctoring on my rules for 3 days now! Since most of the rules rewrite the whole meaning of the URL anyway, i demand a usable .htaccess file for the root directory to point up to /web.

Conditions

/root
  .htaccess
  /config
    databases.yml
  /web
    index.php
    /images
      test.jpg


Capabilitys

http://shared.host.com/config/databases.yml <= web/config/databases.yml <= 404!

http://shared.host.com/default/index <= /web/index.php/default/index

http://shared.host.com/default/index <= /web/images/test.jpg

+ Caching and all the other tricks.

I hope most of you share my opinion that this should be a default feature / official plugin for symfony.

greetings, scott7


propel-insert-sql: 277 of 290 SQL statements executed successfully
Re: shared host root ready .htaccess [message #57669 is a reply to message #57664 ] Sat, 02 August 2008 15:02 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
I understand this can be frustrating, but "request" would probably be better than "demand" Rolling Eyes

Have you read the shared host installation guides? It seems that the strategy people have often taken is to use public_html *instead of* the web folder. Have a look here:

http://trac.symfony-project.org/wiki#Installingsymfony

If that gets you nowhere, I think there will be several examples of htaccess hacking in the fora itself.


Remember Palestine
Re: shared host root ready .htaccess [message #57678 is a reply to message #57664 ] Sat, 02 August 2008 21:59 Go to previous messageGo to next message
scott7  is currently offline scott7
Messages: 86
Registered: December 2007
Location: Dresden, Germany
Member
I'm sorry for my harsh words now. We'll see if i manage to build a solution tomorrow.


propel-insert-sql: 277 of 290 SQL statements executed successfully
Re: shared host root ready .htaccess [message #58234 is a reply to message #57664 ] Fri, 08 August 2008 00:19 Go to previous messageGo to next message
scott7  is currently offline scott7
Messages: 86
Registered: December 2007
Location: Dresden, Germany
Member
They all no use.

I have a subdomain, root folder ist public. I just need a .htaccess that works in / not /web while the files of /web reside in /web.

Freaking mod_rewrite is so complicated.

Nightmare mode: no Command Line!

[Updated on: Fri, 08 August 2008 00:23]


propel-insert-sql: 277 of 290 SQL statements executed successfully
Re: shared host root ready .htaccess [message #58236 is a reply to message #57664 ] Fri, 08 August 2008 01:06 Go to previous messageGo to next message
scott7  is currently offline scott7
Messages: 86
Registered: December 2007
Location: Dresden, Germany
Member
A little logic, great motivation and bang i've done it.
Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On
  
  # we skip all files in /web
  RewriteCond %{REQUEST_URI} ^/web/
  RewriteRule .* - [L]
  
  # we rewrite all other files with .something to /web
  RewriteCond %{REQUEST_URI} \..+$
  RewriteCond %{REQUEST_URI} !\.html$
  RewriteRule ^(.*)$ /web/$1 [L]
  
  # !!! UNTESTED !!! ##################################
  # we check if the .html version is in /web (caching)
  RewriteRule ^$ /web/index.html [QSA]
  RewriteRule ^([^.]+)$ /web/$1.html [QSA]
  #####################################################
  
  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ /web/index.php [QSA,L]
  
</IfModule>

# big crash from our front web controller
ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"

the files in /config are safe, images, controllers work nicely. I don't fully get the caching part and how to test it. I hope someone can verify and help me publish this for good.

UPDATE:
You'll also need this at the beginning of your /web/index.php:
<?php

/* according to .htaccess */
$_SERVER['SCRIPT_NAME'] = '/index.php';

define('SF_ROOT_DIR',...

[Updated on: Mon, 08 September 2008 16:59]


propel-insert-sql: 277 of 290 SQL statements executed successfully
Re: shared host root ready .htaccess [message #63490 is a reply to message #58236 ] Mon, 20 October 2008 05:32 Go to previous messageGo to next message
partypoooperz  is currently offline partypoooperz
Messages: 34
Registered: June 2008
Member
Thanks dude, Your htaccess works perfectly well.

Btw, How do you test the caching? Hope you have the solutions by now Very Happy

[Updated on: Mon, 20 October 2008 05:37]

Re: shared host root ready .htaccess [message #79076 is a reply to message #58236 ] Thu, 28 May 2009 06:29 Go to previous messageGo to next message
dakshayani.r  is currently offline dakshayani.r
Messages: 5
Registered: April 2009
Junior Member
hi,

I do have a same issue of removing web directory from url path, so i tried it by making changes in web directory .htaccess file as u mentioned in ur post #58236 and also made changes in /web/index.php by defining root directory.

define('SF_ROOT_DIR','ask');

but it is not working and gives me a error as follows:

The requested URL /ask/index.php was not found on this server.

Actually askeet files are in "ask" main folder and "web" directory inside ask. It works with url http://localhost/ask/web/. but I want it to work with url http://localhost/ask/.

Please let me know have I done anything wrong in this. I need this to work urgently please help me.

Thanks,
Daksha
Re: shared host root ready .htaccess [message #84686 is a reply to message #58236 ] Tue, 01 September 2009 18:39 Go to previous messageGo to next message
ntuanphuc  is currently offline ntuanphuc
Messages: 2
Registered: April 2009
Location: Viet Nam
Junior Member

Hi Scott7,
I'm using sf1.2 and I've tried your .htaccess file and changed web/index.php, then I run my page http://mydomain.com/ it works fine but this URL http://mydomain.com/mymodule has an error "500 internal server error"
Could you help me to solve the issue.
Thanks in advance and hope you could reply as soon as posible.
Re: shared host root ready .htaccess [message #84787 is a reply to message #57664 ] Thu, 03 September 2009 15:53 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
ntuanphuc, your question is general enough to be addressed to everyone.

Look in your logs to see what the problem might be - looks like you have a general PHP/database error. Try using your *_dev.php front controller, and the error should appear on your screen.


Remember Palestine
Re: shared host root ready .htaccess [message #98117 is a reply to message #79076 ] Tue, 27 April 2010 12:20 Go to previous messageGo to next message
inf3rno  is currently offline inf3rno
Messages: 1
Registered: April 2010
Junior Member
I had similar problem with the "web" in the URI, here is the solution:
http://weblabor.hu/forumok/temak/104781

[Updated on: Tue, 27 April 2010 12:21]

Re: shared host root ready .htaccess [message #98405 is a reply to message #98117 ] Sun, 02 May 2010 20:46 Go to previous messageGo to next message
lkrubner  is currently offline lkrubner
Messages: 297
Registered: July 2008
Location: Virginia, USA
Faithful Member
Scott, I think your mod_rewrite rules will help others, so I posted your trick on my blog:

http://www.teamlalala.com/blog/2010/05/02/how-to-handle-symf ony-on-shared-hosting/



Symfony Experts offers answers: http://www.symfonyexperts.com/
Re: shared host root ready .htaccess [message #102500 is a reply to message #57664 ] Thu, 15 July 2010 06:59 Go to previous message
ice_j7  is currently offline ice_j7
Messages: 116
Registered: February 2008
Location: Arequipa - PerĂº
Senior Member
Thanks!!!!!!!!!! it works!!!

Regards!!!


Search in the code, find wisdom.
Previous Topic:Cache directory problem, uncaught exception sfCacheException, tried everything nothing works
Next Topic:installation with ubuntu 10.4
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software