Wednesday, February 16, 2011

Apache rewriteRules act differently on different hosts/shared hosts. A Zend Framework installation

I was testing the Zend Framework on a shared host and it happens that they do not allow modication of your Apache virtual host Document Root. Meaning if you are using a Zend Framework or some other CMS that requires you to point to a directory within your document root say a sub directory named /Public you may have some problems.

To solve this problem this .htaccess worked on my shared host:
credits too: http://www.alberton.info/zend_framework_mod_rewrite_shared_hosting.html

RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""

RewriteRule ^.*$ public/index.php [NC,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ public/$1 [NC,L]
RewriteRule ^public/.*$ public/index.php [NC,L]

The above .htaccess worked fine in my Shared host but DO NOT work in my own dev box running Ubuntu with PHP as an Apache module. I keep getting "Request exceeded the limit of 10 internal redirects due to probable configuration error." problems in Apache.

To rectify this i have to edit the .htaccess again to:

RewriteEngine On
RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ public/index.php [NC,L]
I also  have to "retain" the original .htaccess that comes from ZF in the Public directory where as in my shared host i have to REMOVE it or I will keep getting Error 500.

To conclude, I have no idea why different rewrites work from the other. I dont know if its Apache version, PHP version, compilation whatevert. I am pretty much clueless actually but try to mix match i guess if things doesnt make sense?

7 comments:

Unknown said...

Sergei , October 22, 1970 Born in Christian Louboutin Bois Dore Moscow State Ozherelye. Perhaps influenced by Cheap LV Handbags their parents worship warrior army, join the army in cheap jordans 1989, and into the elite airborne military service. 1991, by the influence of the Soviet Union, the uggs on sale Russian christian louboutin army general lack of funds, a large number ugg australia of Air Jordan 11 Gamma Blue soldiers seeking veterans, but under extremely difficult conditions still dedicated, praise superiors, and soon was sent to the famous christian louboutin shoes Ryazan Higher ugg Airborne Command School studies. After graduating in 1994, entered the famous Pskov 76th Guards Airborne discount christian louboutin Division, served as discount nike jordans the reconnaissance platoon, reconnaissance ugg soldes deputy company commander, company commander, battalion airborne regiment scouting director and other duties.From 2000 to Cheap Louis Vuitton Handbags 2004, where the forces have repeatedly ordered war with Chechen militants. Because of their opponents in order to form the squad activity and haunted impermanence, the Russians had to ugg boots mobilize elite troops set up large uggs outlet number of small units, "a Discount Louis Vuitton small wholesale jordan shoes play small" Implementation siege. commanding troops in Chechnya, Christian Louboutin Daffodile Ingushetia and other places over the mountains, to track the militants fled. Discount LV Handbags Although the militants were extremely vigilant, but as long as the task has never had outsmarted.August 8, 2008, Georgia suddenly invade South Ossetia (Russian peacekeepers stationed ugg pas cher there), the Russian military to respond quickly, including including the 76th Guards Airborne Division, more than christian louboutin remise 50% 3,000 people were immediately delivered to the pro-Russian Abkhazia, Georgia cheap nike jordan shoes Army contain two infantry brigades, effectively coordinate the cheap christian louboutin direction of the Russian Bags Louis Vuitton troops in South Ossetia.

chenlina said...

chenlina20160127
michael kors outlet
michael kors outlet online
polo ralph lauren
oakkey sunglasses
swarovski outlet
louis vuitton outlet
jordan retro
louis vuitton handbags
abercrombie outlet
oakley sunglasses
jordan retro 11
toms outlet
coach outlet online
coach outlet
burberry scarf
coach factory outlet
coach factory outlet
ed hardy clothing
cheap oakley sunglasses
lebron shoes
louis vuitton handbags
adidas superstars
louis vuitton outlet
ray ban sunglasses outlet
cheap jordans
coach factory outlet
michael kors outlet
ugg sale
beats by dr dre
canada goose outlet
louis vuitton
christian louboutin shoes
oakley outlet
ray ban sunglasses
ugg outlett
oakley sunglasses
abercrombie and fitch
ray ban sunglasses
soccer shoes
true religion jeans outlet
as

Unknown said...

dolce and gabbana shoes
cheap michael kors handbags
hugo boss sale
saints jerseys
red valentino
oklahoma city thunder jerseys
moncler jackets
minnesota vikings jerseys
jaguars jersey
canada goose jackets

Unknown said...

20170402 junda
polo outlet stores
louis vuitton
cheap oakley sunglasses
air max uk
michael kors outlet clearance
coach factory outlet
ray ban sunglasses
louis vuitton handbags
fitflops sale clearance
longchamp handbags

caiyan said...

a

Unknown said...

snapbacks wholesale
gucci outlet online
coach outlet online
cheap oakley sunglasses
michael kors outlet online
ralph lauren outlet
michael kors outlet clearance
pandora jewellery
cheap ray ban sunglasses
michael kors outlet clearance
20170617lck

Unknown said...

snapbacks wholesale
gucci outlet online
coach outlet online
cheap oakley sunglasses
michael kors outlet online
ralph lauren outlet
michael kors outlet clearance
pandora jewellery
cheap ray ban sunglasses
michael kors outlet clearance
20170617lck