2016-07-14 114 views
1

我使用笨我的web應用程序,我改變了項目的結構如下所示:重寫URL笨

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

我創建的文件夾的public_html從單獨的類我的公開文件等.. ,但現在我每次都調用這個網址:

my_project/public_html/controller/action 

我希望它是這樣的:

my_project/controller/action 

我ALR伊迪搬出從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

我說在我的.htaccess結束那些線,仍然沒有工作 –

+0

他們需要在'RewriteEngine On'下進入'.htaccess'的頂部。另外,請在測試之前清除緩存。 – Lag

+0

感謝您的反饋,仍然沒有:s –