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?

14 comments:

co wendy 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.

Zheng junxai5 said...

2015-09-16 zhengjx
coach factory outlet
Louis Vuitton Outlet Handbags Pursers In USA
Michael Kors Outlet Online Store Clearance
Coach Factory Outlet Online Sale Discount
Original Michael Kors Handbags Outlet Online
Coach Outlet Store Online Clearance
Cheap Michael Kors Handbags On Sale
Official Cheap Michael Kors Handbags Outlet
ugg boots
louis vuitton
cheap nfl jerseys
Louis Vuitton Outlet Store Locations
abercrombie & fitch
Coach Factory Outlet Official Website
louis vuitton outlet
michael kors
Michael Kors Outlet Stores Online
canada goose outlet
Kobe Shoes,Kobe 9,Kobe 8 Discount
Coach Factory Outlet Official Coach Handbags Sale
ray-ban sunglasses
Louis Vuitton Handbags Outlet Online
michael kors bag
Coach Outlet Online Coach Factory Outlet
Louis Vuitton Handbags UK For Sale
Louis Vuitton Handbags Official USA Website
timberland boots
ugg boots
Oakley Sunglasses Official Website Cheap Off
coach factory outlet online

mao qiuyun said...

ray ban sunglasses, http://www.raybansunglassesonline.us.com/
nike trainers, http://www.niketrainers.me.uk/
gucci handbags, http://www.guccihandbags-outlet.co.uk/
herve leger, http://www.herveleger.us.com/
timberland boots, http://www.timberlandboots.name/
coach outlet online, http://www.coachoutletonline-store.us.com/
michael kors outlet, http://www.michaelkorsoutletcanada.in.net/
juicy couture outlet, http://www.juicycoutureoutlet.net/
calvin klein underwear, http://www.calvinklein.in.net/
ray ban sunglasses, http://www.raybansunglass.us.com/
prada outlet, http://www.pradaoutlet.us/
lululemon outlet, http://www.lululemonoutletstore.in.net/
tory burch shoes, http://www.toryburchshoesoutlet.com/
michael kors outlet, http://www.michaelkorsoutlet.org.uk/
replica watches, http://www.replicawatchesforsale.us.com/
pandora jewelry, http://www.pandorajewelryoutlet.us.com/
nfl jerseys wholesale, http://www.nfljerseys-wholesale.us.com/
michael kors outlet, http://www.michaelkorsoutletonlinstore.us.com/
oakley outlet, http://www.oakleyoutlet.in.net/
oakley sunglasses, http://www.oakleysunglasses-outlet.us.com/
michael kors bags, http://www.michaelkorsbags.uk/
ray ban sunglasses, http://www.ray-bansunglasses.eu.com/
oakley sunglasses, http://www.oakley.in.net/
air max 2015, http://www.airmax2015.in.net/
the north face uk, http://www.thenorthfaces.org.uk/
swarovski outlet, http://www.swarovski-outlet.co.uk/
pandora jewelry, http://www.pandora.eu.com/
chanel handbags, http://www.chanelhandbags-outlet.co.uk/
1002maoqiuyun

chenlina said...

chenlina20151127
uggs boots
canada goose jackets
ugg outlet
louis vuitton handbags
gucci shoes
ray ban outlet store
mont blanc legend
michael kors handbags
ray ban sunglasses
louis vuitton handbags
cheap uggs
hollister co
kobe 9
adidas superstars
hollister
north face jackets
tory burch sale
ugg australia
louis vuitton handbags
timberland outlet
michael kors outlet online
canada goose jackets
louis vuitton outlet
hollister co,hollister jeans,hollister.com,hollister ca
coach outlet store online
michael kors outlet
louis vuitton purses
michael kors outlet
uggs on sale
adidas originals
louis vuitton
louis vuitton handbags
michael kors outlet online
giuseppe zanotti
nike roshe run women
ugg boots on sale
michaek kors outlet online
nike huarache shoes
canada goose jackets
nike trainers uk
as

方松腾 said...

bottega veneta outlet online
burberry outlet
cheap toms
polo ralph lauren outlet
coach outlet store online,coach outlet store,coach outlet
nba jerseys wholesale
moncler outlet
ugg boots clearance
valentino shoes
michael kors factory sale
rolex watches
kobe bryants shoes 2015
mont blanc
true religion jeans,cheap true religion jeans,true religion jeans wholesale,true religion outlet,true religion sale,true religion outlet online
ray-ban sunglasses
ysl outlet online
louis vuitton outlet
lebron james shoes,lebron 12,lebron 12 shoes,lebron sneakers,lebron iv,lebron 11,lebron 10
hermes outlet online
cheap oakley sunglasses
celine outlet
cleveland cavaliers
football shirts uk,soccer jerseys uk,cheap soccer jerseys uk
ferragamo shoes
pandora charms
ralph lauren,ralph lauren uk,ralph lauren outlet,ralph lauren outlet online,polo ralph lauren outlet,ralph lauren polo
omega watches
michael kors uk outlet
burberry outlet
christian louboutin

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

Blogger said...

Bluehost is definitely one of the best hosting provider for any hosting plans you require.

roshini said...


Sage Support Phone Number
Sage 50 Tech Support Phone Number
Sage 50 Support Number
Sage 50 Technical Support Phone Number
Sage 50 Tech Support Number
Sage 50 Technical Support Phone Number
Sage 50 Technical Support Number
Sage 50 Customer Support Phone Number
Sage 50 Customer Service Number

Soni yadav said...

Aol Technical Support Phone Number
Aol Technical Support Number
Aol Tech Support Number
Aol Tech Support phone Number
Aol Support Phone Number
Aol Tech Support Number
Outlook Technical Support Phone Number
Outlook Technical Support Number
Outlook Tech Support Number
Outlook Tech Support Phone Number
Outlook Support Phone Number
Outlook Tech Support Number

Anjilo Jilo said...


Quicken Support Phone Number
Quicken Support Phone Number
Quicken Support Number
Quicken Tech Support Number
Quicken Tech Support Phone Number
Quicken Technical Support Number
Quicken Technical Support Phone Number
Quicken Technical Support Number
Quicken Tech Support Phone Number
Quicken Tech Support Number

mohan kumar said...

Quickbooks Support Phone Number
Quickbooks Pro Support Phone Number
Quickbooks Pro Tech Support Number
Quickbooks Pro Support Number
Quickbooks Pro Technical Support Number
Quickbooks Pro Tech Support Phone Number
Quickbooks Pro Technical Support Phone Number
Quickbooks Pro Help Desk Phone Number
Quickbooks Pro Help Desk Number
Quickbooks Pro Customer Service Number
Quickbooks Pro Customer Service Phone Number
Quickbooks Pro Customer Support Number
Quickbooks Pro Customer Support Phone Number

Kanika Jaiswal said...

QuickBooks Payroll Technician
Quickbooks Payroll Support Phone Number
Quickbooks Payroll Tech Support Number
Quickbooks Payroll Support Number
Quickbooks Payroll Technical Support Number
Quickbooks Payroll Tech Support Phone Number
Quickbooks Payroll Technical Support Phone Number
Quickbooks Payroll Help Desk Phone Number
Quickbooks Payroll Help Desk Number
Quickbooks Payroll Customer Service Number
Quickbooks Payroll Customer Service Phone Number
Quickbooks Payroll Customer Support Number
Quickbooks Payroll Customer Support Phone Number

Mohini Roy said...

Quicken Support Number
Quicken Support Phone Number
Quicken Tech Support Number
Quicken Support Number
Quicken Technical Support Number
Quicken Tech Support Phone Number
Quicken Customer Service Number
Quicken Customer Service Phone Number
Quicken Customer Support Number
Quicken Customer Support Phone Number
Quicken Help Desk Phone Number
Quicken Help Desk Number

Mohini Roy said...

Quicken Tech Support Number
Quicken Support Phone Number
Quicken Tech Support Number
Quicken Support Number
Quicken Technical Support Number
Quicken Tech Support Phone Number
Quicken Customer Service Number
Quicken Customer Service Phone Number
Quicken Customer Support Number
Quicken Customer Support Phone Number
Quicken Help Desk Phone Number
Quicken Help Desk Number