简体   繁体   English

无法在 URL 上隐藏 Index.php 页面

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

I run a site using Joomla cms where we disabled index.php in URL but it doesn't work now我使用 Joomla cms 运行一个站点,我们在 URL 中禁用了index.php但它现在不起作用

mysite.com/index.php

Then we tried with .htaccess file with following commands then at the homepage its disabled然后我们尝试使用以下命令使用.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]
#

Works fine on the home page alone单独在主页上工作正常

mysite.com

But when I pass to any page from the home page it throws an error, when I tried with index.php in between then it works,但是当我从主页传递到任何页面时,它会引发错误,当我尝试在两者之间使用 index.php 时,它可以工作,

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

I need help to permanently disable the index.php inside URL even when I try to pass on to any other page from the home page, thanks in advance.即使我尝试从主页传递到任何其他页面,我也需要帮助以永久禁用 URL 内的index.php ,在此先感谢。

Did you add following lines at the beginning?您是否在开头添加了以下几行?

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