2012-11-18 17 views
0

我通常使用這個htaccess文件從我的網址在ExpressionEngine重定向其中IP是不是&&刪除的index.php

AddType video/ogg .ogv 
AddType video/mp4 .mp4 
AddType video/webm .webm 

AcceptPathInfo On 

Options -Indexes 

<IfModule mod_rewrite.c> 
RewriteEngine On 

Options +FollowSymLinks 

# Looks for files and directories that do not exist 
# and provide the segments to the index.php file 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !^/index.php 
RewriteCond $1 !.(css|js|png|jpe?g|gif|ico)$ [NC] 
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

雖然這一偉大工程,我們進入這個網站投入生產之前刪除的index.php ,我們通過這個htaccess文件

RewriteEngine On 
RewriteBase/
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 
RewriteRule ^(.*)$ http://www.anotherdomain.com/ [R=301,NC] 

我自己的IP地址替換localhost的調用,這樣我可以訪問該站點的所有指揮交通,以給定的URL到另一個。

基本上我正在尋找的是這兩個組合,將從我的網址中刪除index.php,但仍然重定向其他人。

感謝, 史蒂芬

+0

不知道你需要什麼,但你說你需要兩個結合 - 那麼,爲什麼你不只是添加了'REMOTE_ADDR上述重寫的條件?我錯過了什麼? –

+0

就是這樣,我試過了。我按照通常的規則添加了我的{REMOTE_ADDR}規則,但即使添加了我的IP地址,我也總是被重定向。 –

回答

0

發現這個偉大工程:

RewriteEngine on 

# If your IP address matches any of these - then dont re-write 
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 
RewriteRule ^(.*)$ http://www.anothersite.com/ [R=302,L] 


# do not rewrite links to the assets and theme files 
RewriteCond $1 !^(assets|themes|images) 

# do not rewrite for php files in the document root, robots.txt etc 
RewriteCond $1 !^([^\..]+\.php|robots\.txt|crossdomain\.xml) 

# but rewrite everything else 
RewriteRule ^(.*)$ index.php/$1 [L] 
相關問題