最新消息:郑州SEO笔记与大家一起分享和学习seo知识,一起分析网站seo案例,探析seo技巧!

eyoucms伪静态去掉index.php尾巴

易优cms admin 675浏览

eyoucms(易优CMS)在不同虚拟空间,运行PHP的环境会出现不同问题,目前主要分为:Nginx、apache、IIS以及其他服务器,有些自动去除了index.php进行重写,有些url中还带着小尾巴index.php,看着很是不爽,今天就将上面的不同环境下的去掉index.php的方法全收集下来,以下操作记得清除缓存,第一个是我经常用的,肯定是没问题的,其它三个环境也是从EYOUcMS整理出来的。

一、宝塔环境Nginx下Eyoucms去掉index.php方法。

先在网站后台SEO设置设置为伪静态,然后在宝塔控制面板的网站对应的设置里,选择伪静态,点击下拉,选择thinkphp,保存。然后后台清下缓存即可去除index.php小尾巴。

二、IIS服务器去掉index.php

查看服务器的网站根目录下是否有 web.config 文件,将下面代码添加<system.webServer>与</system.webServer>之间。如果没有web.config文件,就将全部代码保存为web.config文件,上传到网站根目录下,记得去后台清除缓存,再从网站首页访问。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

三、apache服务器
易优CMS在apache服务器环境下是默认自动隐藏index.php的。如果发现没隐藏,可以检查根目录.htaccess是否含有以下红色代码段:

<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
       #http跳转到https
       #RewriteCond %{HTTPS} !=on
       #RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]
 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
</IfModule>

如果还是没有隐藏,可以尝试把红色第四行的代码改为加上个问号试试: RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
或者修改为:RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

如果还是不行,继续查看apache是否开启了URL重写模块 rewrite_module , 然后重启服务就行了。

四、LAMP集成环境怎么去除url中的index.php
如图所示:只要点击勾选apache的rewrite_module模块就OK,如果没自动重启,那就还得重启服务器哦!

转载请注明:郑州SEO优化_郑州网站优化 » eyoucms伪静态去掉index.php尾巴