[英]htaccess clean urls with with sub folder
I'm trying to create clean urls on my gallery website. 我正在尝试在我的画廊网站上创建干净的URL。
<http://sloanegalleryofart.com>
I was able to clean up general navigation. 我能够清理常规导航。 However, run in some hardcore difficulties while trying to configure sub folders 但是,在尝试配置子文件夹时遇到一些困难
Curretnly my htaccess looks like so Curretnly我的htaccess看起来像这样
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^sloanegalleryofart.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.sloanegalleryofart.com$
RewriteCond %{REQUEST_URI} !/
RewriteRule (.*) /$1 [L]
RewriteRule ^about/$ /about/about.php
RewriteRule ^contact/$ /contact/contact.php
RewriteRule ^shows/$ /shows/shows.php
RewriteRule ^artists/$ /artists/artists.php
RewriteRule ^books/$ /books/books.php
If I try to navigate from artists page sloanegalleryofart.com/artists
to each individual artist it looks like so sloanegalleryofart.com/artists/artist.php?artist=Gleb-Bogomolov
如果我尝试从艺术家页面sloanegalleryofart.com/artists
导航到每个艺术家,那么sloanegalleryofart.com/artists/artist.php?artist=Gleb-Bogomolov
When ideally I want it to be sloanegalleryofart.com/artists/Gleb-Bogomolov/
. 理想情况下,我希望它是sloanegalleryofart.com/artists/Gleb-Bogomolov/
。 Just cut out the whole artist.php?artist=
out of the url. 只需从网址中删除整个artist.php?artist=
。
Thank you in advance ! 先感谢您 !
This is your solution 这是你的解决方案
RewriteRule ^artists/([0-9a-zA-Z\-]{1,})?/?$ /artists/artists.php?artist=$1
When you access http://sloanegalleryofart.com/artists/Gleb-Bogomolov
当您访问http://sloanegalleryofart.com/artists/Gleb-Bogomolov
you will be seen http://sloanegalleryofart.com/artists/artists.php?artist=Gleb-Bogomolov
您将看到http://sloanegalleryofart.com/artists/artists.php?artist=Gleb-Bogomolov
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.