我有我的htaccess和路由文件的問題。我想配置我的default_controller。Codeigniter htaccess和路由文件
$route['default_controller'] = 'fr/index';
我想使用URL重寫。使用htaccess文件刪除我的URL中的'index.php'。
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/page=$1 [QSA]
RewriteCond $1 !^(index.php|assets/|robots.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
當一方有效時,另一方不起作用。
你有一個想法,配置我的htaccess刪除'index.php',並添加一個default_controller routes.php?
我的控制器有一個子文件夾的應用程序/控制器/子/ myControllers.php
謝謝你的答案。
感謝您的回答。第12行存在問題。什麼標誌?我在OVH有一個共享主機。在本地主機上,我沒有配置問題,但沒有共享主機。 –
你應該檢查你的服務器上的mod-rewrite配置。 –
也編輯答案,固定線12. –