https://www.URL/index.php/iadmin/dashboard/index/key/
是否有辦法只在URL中包含iadmin路徑的情況下洗掉該URL的index.php/部分?
我在Apache上運行Magento,在更新Apache和php之后,我的管理頁面只有在我從它的URL中移除index.php時才能打開。
我的原始htaccess是這樣的
我的原始htaccess看起來是這樣的
############################################
##取消CGI模式的這幾行。
##確保指定正確的cgi php二進制檔案名。
##它可能是/cgi-bin/php-cgi。
# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php。
############################################
## GoDaddy的具體選項。
# 選項 -MultiViews
##你可能還需要在php.ini中添加這一行
## cgi.fix_pathinfo = 1
## 如果還是不行,把php.ini重命名為php5.ini。
############################################
##這一行是針對1and1托管的。
#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php
############################################
##默認索引檔案
DirectoryIndex index.php
<IfModule mod_php5.c>
############################################
##調整記憶體限制。
# php_value memory_limit 64M
php_value memory_limit 256M
php_value max_execution_time 18000 18000
############################################
## disable magic quotes for php request vars
php_flag magic_quotes_gpc off
############################################
## disable automatic session start[/span]。
##在自動加載被初始化之前
php_flag session.auto_startoff
############################################
## enable resulting html compression
#php_flag zlib.output_compression on
#####################################
# disable user agent verification to not break multiple image upload
php_flag suhosin.session.cryptua off
#####################################
# 在處理物件時關閉與PHP4的兼容性。
php_flag zend.ze1_compatibility_mode Off
</IfModule>
<IfModule mod_security.c>
#####################################
# disable POST processing to not break multiple image upload
關閉SecFilterEngine
SecFilterScanPOST 關
</IfModule>
<IfModule mod_deflate.c>
############################################
##啟用apache服務檔案壓縮。
## http://developer.yahoo.com/performance/rules.html#gzip
# 對所有內容插入過濾器 # 插入過濾器
###SetOutputFilter DEFLATE
#只在選定的內容型別上插入過濾器
#AddOutputFilterByType DEFLATE text/html text/lain text/xml text/css text/javascript
#Netscape 4.x有一些問題......
#BrowserMatch ^Mozilla/4 gzip-only-text/html
#Netscape 4.06-4.08還有一些問題
#BrowserMatch ^Mozilla/4.0[678] no-gzip
#MSIE會偽裝成Netscape,但它是好的
#BrowserMatch MSIE !no-gzip !gzip-only-text/html
#不要壓縮影像
#SetEnvIfNoCase Request_URI . (?:gif|jpe?g|png)$ no-gzip dont-vary
#確保代理機構不會傳遞錯誤的內容
#Header append Vary User-Agent env=!dont-vary
</IfModule>
<IfModule mod_ssl.c>
############################################
##使HTTPS環境變數對CGI模式可用
SSLOptions StdEnvVars
</IfModule>
<IfModule mod_rewrite.c>
############################################
## 啟用重寫程式
選項 FollowSymLinks
重寫引擎開啟
RewriteCond %{HTTPS}! !^on$
RewriteRule (.*) https://www.MYSITEcom/$1 [R,L]
RewriteCond %{HTTP_HOST}! ^MYSITEcom [NC]
RewriteRule ^(.*)$ https://www.MYSITEcom/$1 [L,R=301]
RewriteCond %{HTTPS_HOST} ^MYSITEcom [NC]. ^MYSITEcom [NC]
RewriteRule ^(.*)$ https://www.MYSITEcom/$1 [L,R=301]
############################################
##你可以把你的Magento根檔案夾放在這里
##相對于網站根目錄的路徑
#RewriteBase /magento/
############################################
## 解除下一行的注釋,以啟用輕量級的API呼叫處理
# RewriteRule ^api/([a-z][0-9a-z_] )/?$ api.php?type=$1 [QSA,L]
############################################
## 重寫API2對api.php的呼叫(到現在它只是REST)。
RewriteRule ^api/rest api.php?type=rest [QSA,L]
############################################
##HTTP授權的變通方法
##在CGI環境中
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]。
### ###### ###### #############################
## TRACE和TRACK HTTP方法被禁用,以防止XSS攻擊
RewriteCond%{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405)
### ###### ###### #############################
##為移動用戶代理重定向
#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
#RewriteCond %{HTTP_USER_AGENT}! "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC)
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302] 。
############################################
##在這些檔案夾中缺少檔案時總是發送404
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/!
############################################
## 絕不對現有檔案、目錄和鏈接進行重寫
RewriteCond %{REQUEST_FILENAME}! !-f
RewriteCond %{REQUEST_FILENAME}! !-d
RewriteCond %{REQUEST_FILENAME}! !-l
############################################
##重寫其他所有內容至index.php
RewriteRule .* index.php [L]
</IfModule>
############################################
## 防止服務器重寫的字符編碼問題
## 如果你仍然有問題,使用第二行來代替
AddDefaultCharset Off
#AddDefaultCharset UTF-8
<IfModule mod_expires.c>
############################################
## 添加默認的 "過期 "標題
## http://developer.yahoo.com/performance/rules.html#expires
ExpiresDefault "訪問加1年"
</IfModule>
############################################
## 默認允許所有訪問
命令允許,拒絕
允許從所有
###########################################
## 拒絕訪問發行說明,以防止泄露已安裝的Magento版本
<Files RELEASE_NOTES.txt>。
允許,拒絕的順序
拒絕來自所有
</Files>
############################################
## 如果在集群環境中運行,請取消注釋
## http://developer.yahoo.com/performance/rules.html#etags
#FileETag none
uj5u.com熱心網友回復:
你可以在RewriteBase行下面插入這個規則,以從URL中洗掉index.php:
RewriteCond %{THE_REQUEST} s/ index.php/(iadmin/S*)s [NC]
RewriteRule ^ /%1 [L,NE,R=301]
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/320580.html
標籤:
