我在codeigniter路由中遇到了一些麻煩。我有一個託管服務器的活網站&這裏是它的htaccess。本地主機的Codeigniter htaccess
#php_value memory_limit 256M
#php_value upload_max_filesize 50M
#php_value post_max_size 70M
AddType font/opentype .otf
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType application/font-woff .woff
AddDefaultCharset utf-8
<IfModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymLinks
RewriteBase/
RewriteRule ^favicon.* - [L]
RewriteRule ^search /categories [R=301,L]
RewriteRule ^login/[R=301,L]
RewriteRule ^pages/disclaimer /pages/integritetspolicy [R=301,L]
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^index.php$ http://%{HTTP_HOST} [R=301,L]
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (utredningar/post)
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(utredningar/post)
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
這與域名(example.com)&託管服務器完美的作品。在其他視圖header.view &鏈接給出
<href="/assets/styles/home.css?9">
但是,當我試圖讓在本地主機WAMP這項工作,這是行不通的。 Assets(css/js/images)不加載& url路由不起作用。
我已經這兩行
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
修飾以
RewriteCond %{HTTP_HOST} !^localhost
RewriteRule (.*) http://localhost/example/$1 [R=301,L]
我改變應用程序/配置/ config.php中,加入鹼的url,取出的index.php等。
我已盡全力讓它工作,請指出我在哪裏做錯了..非常感謝
您使用CI的哪個版本的根目錄? – Saty
這是2.1,但我已將系統更改爲2.2以及..仍不起作用.. –
您使用的是godaddy服務器嗎? –