.htaccess 如何为子域配置yii URL管理器
也许这个问题已经在某个地方被问过了,但我找不到任何适合我的问题 我正在使用yii及其URL管理器创建一个网站。在我的localhost中,URL管理器工作得非常好。但问题出现在我将其上传到带有子域的服务器之后。域和子域应为.htaccess 如何为子域配置yii URL管理器,.htaccess,yii,yii-url-manager,.htaccess,Yii,Yii Url Manager,也许这个问题已经在某个地方被问过了,但我找不到任何适合我的问题 我正在使用yii及其URL管理器创建一个网站。在我的localhost中,URL管理器工作得非常好。但问题出现在我将其上传到带有子域的服务器之后。域和子域应为http://tokoandhika.mauinimauitu.com 在我的本地主机中,http://localhost/tokoandhika/catalog/category1工作正常。它将访问CatalogController.php中的actionIndex函数。但是
http://tokoandhika.mauinimauitu.com
在我的本地主机中,http://localhost/tokoandhika/catalog/category1
工作正常。它将访问CatalogController.php中的actionIndex函数。但是如果我访问http://tokoandhika.mauinimauitu.com/catalog/category1
,将提示内部服务器错误(PHP错误500)
可能出了什么问题?我需要编辑htaccess文件吗?或者我需要为此添加更多规则吗?任何有用的建议都将不胜感激
以下是我的URL管理器规则:
'rules' => array(
'category/<slug:[a-zA-Z0-9-]+>' => 'category/index',
'page/<slug:[a-zA-Z0-9-]+>' => 'site/page/index',
'gii' => 'gii/default',
'gii/<controller:\w+>/<id:\d+>' => 'gii/<controller>/view',
'gii/<controller:\w+>/<action:\w+>/<id:\d+>' => 'gii/<controller>/<action>',
'gii/<controller:\w+>/<action:\w+>' => 'gii/<controller>/<action>',
'gii/<controller:\w+>/<action:\w+>/id/<id:\w->' => 'gii/<controller>/<action>/id/<id>',
'catalog/addtocart/' => 'catalog/addtocart',
'catalog/detail/<slug:[a-zA-Z0-9-]+>' => 'catalog/detail',
'catalog/<cat:[a-zA-Z0-9-]+>/<subcat:[a-zA-Z0-9-]+>' => 'catalog/index',
'catalog/<cat:[a-zA-Z0-9-]+>' => 'catalog/index',
),
$yii=dirname(文件)。'/../yii/framework/yii.php';源文件中的index.php是否包含这些行?是的,已经有500状态代码告诉您代码中有错误。检查是否可以找到此错误(通过访问错误日志)。是否检查了服务器上的日志文件?我检查了错误日志文件,没有记录任何错误。奇怪的
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