UrlManager and Godaddy trouble


(Rrkprasad) #1

My application with UrlManager enabled works fine in local wamp server. When I hosted it on Godaddy I was getting internal server error. So I removed htaccess and UrlManager code. It worked fine but without beautiful urls.

I’ve restored htaccess and UrlManager code. I’m getting internal server error again.

Screen Shots:

582

screen_shot_with_htaccess_urlmanager.gif

UrlManager Code:


‘urlManager’=>array(

		'urlFormat'=>'path',


		'showScriptName' => false,


		//'caseSensitive'=>false,


		  'rules'=>array(


			'user/register/*'=>'user/create',


			'user/settings/*'=>'user/update',


		),


	),

htaccess Code:


Options +FollowSymLinks

IndexIgnore /

RewriteEngine on

if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

otherwise forward it to index.php

RewriteRule . index.php


(Vamphouse) #2

maybe mod_rewrite not enabled? show version of your http server


(Maurizio Domba Cerin) #3

This error is caused by some command in the .htaccess, try to leave only this in the .htaccess




RewriteEngine on


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php

RewriteRule . index.php												



If you get still the server error code, than mod_rewrite is not enabled!


(Jose Reyes) #4

I also get my Linux hosting from Godaddy and can confirm that rewrites are enabled. My .htaccess looks like this:




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on


# Make backend accessible via url: http://site/backend.

RewriteRule ^sysadmin& backend.php


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php

RewriteRule ^.*$ /index.php [L]



The last line is critical because a single period is not enough. You have to have all the other characters for it to work. Check it out and good luck.


(Der Coole Carl) #5

Hello, today I got the same problem with a domain at http://1und1.de

Thanks to JFReyes it works now :)

Too bad that I can’t investigate the apache log to tell you the exact error


(Jsfousseni) #6

Why is this not workng with me? I’m also using godaddy


(Jose Reyes) #7

I’ve been away from Yii work for a while but recently returned. I can confirm that something changed between my earlier post (Yii 1.1.2?) and the new version 1.1.7. I’ll investigate and ask around; if I find an answer I’ll post it here. Thanks.


(Chande Gaurav) #8

Phew!

Got the solution to the ‘UrlManager + Godaddy’ saga.

This is how the .htaccess file should look. I tried to strip it down to the most required stuff.




RewriteEngine on


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php

RewriteRule ^.*$ /index.php? [L]



See the question mark after ‘index.php’ in the last line? That is it. Just add the ‘?’ after index.php and it shall solve all your problems. No ‘Internal Server Error’ or ‘No Input File Specified’ errors anymore.

Cheers. :)


(Morvornagh) #9

Does not seem like it is quite solved yet, I have the same issue…

Gaurav I used your suggestion below which worked for all of the pages contained in the yii/protected/views/site folder

However I have other pages to access e.g. yii/protected/views/folderA/index.php, yii/protected/views/folderB/index.php etc…

The absolute path is godaddy/html/yii/protected/views/folderA/index.php

The Yii Root framework is outside the web at godaddy/html/yiiroot

Any ideas this is driving me nuts (and of course all works smoothly on localhost)…

Thanks so much

N


(Morvornagh) #10

BTW the error I get is the no input file specified…


(Davidcv5) #11

You are te best! Thank you very much, this is perfect.


(Rahulmeher22) #12

I was also facing same issue but i did this and it worked successfully

So posting it for some new user like me.

.htaccess – you need to place this file where index.php is there




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on


# Make backend accessible via url: 

RewriteRule ^sysadmin& backend.php


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php

RewriteRule ^.*$ /index.php [L]



You need to uncomment url path format and add two more things

Set main.php in your yii configuration, at component :




'urlManager'=>array(

			'urlFormat'=>'path',

                  [b]       'showScriptName'=>false,

     'caseSensitive'=>false,     [/b]

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

		),


also you need



:)


(Colincannon) #13

This is killing me. I followed the last post and I still keep getting "No input file specified."

I am hosted with godaddy and here is my .htaccess




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on


# Make backend accessible via url: 

RewriteRule ^sysadmin& backend.php


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php

RewriteRule ^.*$ /index.php? [L]




Here is my UrlManager in my main.php config file




'urlManager'=>array( 

  'urlFormat'=>'path',

  'showScriptName'=>false,

  'caseSensitive'=>false,

  'rules' => array(

    '' => 'video/player',

    '<controller:\w+>/<id:\d+>'=>'<controller>/view',

    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

  ),

),



Anybody have any ideas, or maybe an suggestions on something obvious I could have missed. It works fine on my local. I didn’t use the yii tools to recreate the site, I just uploaded all the files from my local.


(Stroud Travis) #14

I don’t know about that last line of your .htaccess file. It definitely breaks my Yii application on godaddy. This is what I use for my .htaccess.


Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

RewriteRule .* - [L]


(Menxaca) #15

I also used Goddady and nothing of what is explained here worked for me, better said, only worked for controllers like “PostController”, but having something like “PostCommentController” didn’t work, that’s due to capital letters, so I had to change all my controllers on this way “PostcommentController” (name file and class name).

Hope it helps to you!


(Viil Lid) #16

Hi,

I have tried all the suggestions above on my shared linux hosting with godaddy, with no success :( I still get a file not found error.

BTW: Several of the suggestions above work fine on WAMP on my localhost.

Any suggestion on what to try next?


(Jeff) #17

Hi all,

I am a newbie to the Yii framework and ran into the same issue using a GoDaddy LAMP hosted environment.

I resolved it by creating a php5.ini file in the root directory

my php%.ini file


cgi.fix_pathinfo = 1

my .htaccess file




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

RewriteRule .* - [L]



my urlManagerCode




'urlManager'=>array(

			'urlFormat'=>'path',

			'showScriptName'=>false,

     		'caseSensitive'=>false,

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

		),



Hope this helps!

Cheers!

Jeff Beasley


(C Ramkumar) #18

your idea s not work… i have same problem…!


(Yugenekr) #19

Had the same issue at GoDaddy. Works fine for me with such .htaccess file:





Options -Indexes


RewriteEngine on

RewriteBase /


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php

RewriteRule ^.*$ index.php [NC,L]



CUrlManager configuration basically looks as always:




         	'urlManager'   => array(

             	'urlFormat'      => 'path',

             	'showScriptName' => false,

             	'rules'          => array(

                 	// your rules

             	)

         	),

That’s all in my case.


(Mark) #20

Hi guys,

tried everything suggested in this thread, but with no luck. im using the default urlManager provided by Yii.

Maybe there is a menu somewhere in Goddy where i could enable mod_rewrite?