简体   繁体   English

重写网址不包括布局?

[英]rewrite url doesn't include layout?

I'm currently trying to make SEO friendly url's for my website using this script: 我正在尝试使用此脚本为我的网站制作SEO友好网址:

Options +FollowSymLinks  
RewriteEngine On 
RewriteRule ^show/([0-9]+)/$ show.php?phto=$1
RewriteRule ^index/$ index.php

So i've tested some things, and i've came up with these problems: When i visit my website : blalba.com/index/ my layout file wouldn't include/show up. 所以我测试了一些东西,我想出了这些问题:当我访问我的网站时: blalba.com/index/我的布局文件不会包含/显示。 (using an layout.inc.php header/footer system) (使用layout.inc.php页眉/页脚系统)

Also how can i make it that the user can visit it with index and index/ 另外我怎么能让用户可以使用indexindex/访问它index/

I'm not so good at this.. 我不是很擅长这个..

Grz GRZ

Change your rule with this code (to make trailing slash optional): 使用此代码更改规则(使尾随斜杠可选):

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On

RewriteRule ^show/([0-9]+)/?$ show.php?phto=$1 [L,QSA,NC]
RewriteRule ^index/?$ index.php [L,QSA,NC]

Also make sure for including style, js, images etc always use absolute path ie it should start with / or http:// . 还要确保包括样式,js,图像等始终使用绝对路径,即它应该以/http://开头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM