Home Page Displays But Links Produce 404 Error

Goddady tech support is as clueless as I am!

I have read other post with similar problems and tried implementing recommendations without success.

Could it be something in the php.ini file?




register_globals = off

allow_url_fopen = off


expose_php = Off

max_input_time = 60

variables_order = "EGPCS"

extension_dir = ./

upload_tmp_dir = /tmp

precision = 12

SMTP = relay-hosting.secureserver.net

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="




; Only uncomment zend optimizer lines if your application requires Zend Optimizer support


;[Zend]

;zend_optimizer.optimization_level=15

;zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.3.3

;zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3

;zend_extension=/usr/local/Zend/lib/Optimizer-3.3.3/ZendExtensionManager.so

;zend_extension_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3/ZendExtensionManager_TS.so




; -- Be very careful to not to disable a function which might be needed!

; -- Uncomment the following lines to increase the security of your PHP site.


;disable_functions = "highlight_file,ini_alter,ini_restore,openlog,passthru,

;		      phpinfo, exec, system, dl, fsockopen, set_time_limit,

;                     popen, proc_open, proc_nice,shell_exec,show_source,symlink"



Maybe it is something in the htaccess file located in the root?




RewriteEngine on


# for GoDaddy

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? [L]




have you changed routing rules?

You mean the /config/main.php url rules ? I have not changed them.


// uncomment the following to enable URLs in path-format

		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

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

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

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

			  	      ),

				),




Try removing the question mark on the last line in the .htaccess


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

change to


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

I removed the ? and still nothing different.


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

I found that code posted by someone in another thread, it worked for some but not for others and it was in response to the Godaddy hosting. I have closed the window, but could probably find it again, if it helps.

Here is my site link if it helpsā€¦ My link

This is the topic - http://www.yiiframework.com/forum/index.php/topic/7956-

As you see there for one user the line I suggested worked for the other the one with the question markā€¦

Your problem is definitively related to the htaccess fileā€¦ to check this try to remove ā€˜urlFormatā€™ => ā€˜pathā€™ from the urlManager config and all links should be working but with the ā€œ?r=ā€¦ā€.

Did you check with godady if url_rewrite is enabled for you?

Did you try the htaccess without the "rewrite base"?

Here is one more htaccess version try with that one - http://www.yiiframework.com/forum/index.php/topic/26492-

And here is one more - http://www.yiiframework.com/forum/index.php/topic/12926-

Note that this last one uses rewrite base but then the last line uses only a dot without the ^ and $

1 Like

Only some of the links are working after removing the urlManager arrays.

site/contact==Cutomer Service didnā€™t work and alink in the side column didnā€™t work, but now the error is 500


	<div id="mainmenu">

		<?php $this->widget('zii.widgets.CMenu',array(

			'items'=>array(

				array('label'=>'Home', 'url'=>array('/site/index')),

				array('label'=>'About Us', 'url'=>array('/site/page', 'view'=>'about_pool_police_cleaning')),


				array('label'=>'Pool Cleaning', 'url'=>array('/site/page', 'view'=>'pool_cleaning_services')),

				array('label'=>'Pool Repairs', 'url'=>array('/site/page', 'view'=>'swimming_pool_repair')),

				array('label'=>'Referral Offer', 'url'=>array('/site/page', 'view'=>'free_filter_clean_details')),

				array('label'=>'Customer Service', 'url'=>array('/site/contact')),

				/*array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),*/

				array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest),

				array('label'=>'Sign-Up', 'url'=>array('/users/create'),'visible'=>!Yii::app()->user->isGuest),

				

			),

		)); ?>

	</div><!-- mainmenu -->



I will find out if url_rewrite is enabledā€¦

godaddy tech - url_rewrite is enabled.

He is temporarily enabling the error logā€¦

Just to test this from the beginningā€¦ I would suggest you to create a complete new webapp with yii - the default oneā€¦ and without changing anything to see if all works on your hostingā€¦ only after you check that all worksā€¦ try to enable the url path in that new app (only then add the htaccess)ā€¦ and check again if all worksā€¦

Tech support showed me how get the error logs, which will help.

Thanks mdomba, it is encouraging to see some of the links working. But itā€™s even better that I have a direction to go!

Couldnā€™t I use the testdrive app to validate and test the host environment with url path and htaccess?

My suggestion is to check first with the default webapp created by Yii as this code is tested and works for everybodyā€¦

Btwā€¦ I just checked your page again and the contact page gives this error -

So itā€™s clear what you have to doā€¦ you need to set proper permissions for the ā€œassetsā€ and ā€œprotected/runtimeā€ folders

1 Like

I had the permissions set, the problem; it was in the wrong place! It is now in the ROOT.

The db connectionString wasnā€™t set properly either, but it is working perfectly now!

The links that werenā€™t working have been configured with the echo CHtml:link instead of hard coded a href. One of the links had the wrong controller association, how it worked on the local is a mistery.

I have checked all of the links and the forms, everything is working properly now!! Even the Admin Login! There isnā€™t a link for that, it is called directly. He can check and manage the referrals, but until he adds products or accepts payments online then there is no need for a sign up and login for visitors.

This is why I chose Yii, the site is expected to grow and will need more of the capabilities in the future.

Anyway, I will try to make pretty urls but I will need a break first!!

Thank You So Much!!!

For my function perfectly comment the line of information, thank you for this valuable contribution.