繁体   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