簡體   English   中英

無法在 URL 上隱藏 Index.php 頁面

[英]Not able to hide Index.php page on URL

我使用 Joomla cms 運行一個站點,我們在 URL 中禁用了index.php但它現在不起作用

mysite.com/index.php

然后我們嘗試使用以下命令使用.htaccess文件,然后在主頁上將其禁用

       # Directs all EE web requests through the site index file
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule ^(.*)$ /index.php/$1 [L] 
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#

單獨在主頁上工作正常

mysite.com

但是當我從主頁傳遞到任何頁面時,它會引發錯誤,當我嘗試在兩者之間使用 index.php 時,它可以工作,

mysite.com/something    #throws error with this URL
mysite.com/index.php/something  # works fine with this URL

即使我嘗試從主頁傳遞到任何其他頁面,我也需要幫助以永久禁用 URL 內的index.php ,在此先感謝。

您是否在開頭添加了以下幾行?

Options +FollowSymLinks
RewriteEngine On

# your rules here

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^(.*)$ /index.php/$1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM