简体   繁体   中英

rewrite url doesn't include layout?

I'm currently trying to make SEO friendly url's for my website using this script:

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. (using an layout.inc.php header/footer system)

Also how can i make it that the user can visit it with index and index/

I'm not so good at this..

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:// .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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