2016-07-14 10 views
1

は、私は次のようにプロジェクトの構造を変更:書き換えURL CodeIgniterの

my_Project 
      --- application 
      --- public_html 
         --- resources 
      --- system 

私はクラスから私のパブリックファイルを区切るために、フォルダのpublic_htmlを作成した。..など

my_project/public_html/controller/action 

私は、それはこのようになりたい::

my_project/controller/action 

私はALRが、今、私は毎回このURLを呼び出す必要がありますeadyは、書き換えモードを使用してURLからindex.phpをを移動し、私は、同様のpublic_html取り除くように見えることはできません。

の.htaccess

<IfModule mod_rewrite.c> 
# Turn on URL rewriting 
RewriteEngine On 

# If your website begins from a folder e.g localhost/my_project then 
# you have to change it to: RewriteBase /my_project/ 
# If your site begins from the root e.g. example.local/ then 
# let it as it is 
RewriteBase /uca-flsh/public_html 

# Protect application and system files from being viewed when the index.php is missing 
RewriteCond $1 ^(application|system|private|logs) 

# Rewrite to index.php/access_denied/URL 
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L] 

# Allow these directories and files to be displayed directly: 
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|public|assets|css|js|images|resources|public_html) 

# No rewriting 
RewriteRule ^(.*)$ - [PT,L] 

# Rewrite to index.php/URL 
RewriteRule ^(.*)$ index.php/$1 [PT,L] 
</IfModule> 

.config.php

$config['base_url'] = 'http://localhost/uca-flsh/public_html'; 

答えて

0

はこれを使用してみてください:

RewriteCond %{THE_REQUEST} /my_project/public_html/controller/action [NC] 
RewriteRule^my_project/controller/action [L,R] 
+0

私はまだ彼らがする必要がある –

+0

を動作しませんでした、私の.htaccessの最後にこれらの行を追加しました'RewriteEngine On'の下にある' .htaccess'の先頭に行きます。また、テストする前にキャッシュをクリアしてください。 – Lag

+0

フィードバックのお寄せいただきありがとうございます。 –