Mod rewrite .htaccess提供';扁平的';搜索引擎友好的CMS URL
我正在使用CMSMADESIMPLE作为网站。它可以使用.htaccess文件和mod_重写生成搜索引擎友好的URL 但是可以在基本url和请求页面之间插入任何内容。例如,所有这些URL都可以工作:Mod rewrite .htaccess提供';扁平的';搜索引擎友好的CMS URL,mod-rewrite,Mod Rewrite,我正在使用CMSMADESIMPLE作为网站。它可以使用.htaccess文件和mod_重写生成搜索引擎友好的URL 但是可以在基本url和请求页面之间插入任何内容。例如,所有这些URL都可以工作: www.example.com/aboutus www.example.com/home/aboutus www.example.com/any/rubbish/i/enter/aboutus 我见过其他使用Wordpress的网站,它们可以在地址窗口中输入相同的内容,但会重定向回最低级别,即ww
www.example.com/aboutus
www.example.com/home/aboutus
www.example.com/any/rubbish/i/enter/aboutus
我见过其他使用Wordpress的网站,它们可以在地址窗口中输入相同的内容,但会重定向回最低级别,即www.example.com/aboutus。我想做同样的事情,但我无法掌握。htaccess去做
.htaccess文件的相关位为:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(+)$index.php?页面=$1[QSA]
我假设这是只需使用mod_rewrite就可以实现的,并且不需要在CMS中更改PHP代码
如果这是不可能的,我想设置一个永久重定向从一些网址内的CMS已被谷歌索引
i、 e从www.example.com/home/aboutus到www.example.com/aboutus
我尝试将重写规则添加到.htaccess,但未成功:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule home/aboutus aboutus [R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
重新启动发动机
重写基/
重写规则home/aboutus aboutus[R=301]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(+)$index.php?页面=$1[QSA]
感谢您的帮助。查看doc文件夹中的示例htaccess.txt文件。有一节是关于父子关系的
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]