.htaccess URL重写语法
我刚刚看了一下这个,已经到了我想做的一半了 因此,我将.htaccess文件更改为包含以下内容,从而使其正常工作:.htaccess URL重写语法,.htaccess,rewrite,.htaccess,Rewrite,我刚刚看了一下这个,已经到了我想做的一半了 因此,我将.htaccess文件更改为包含以下内容,从而使其正常工作: Options +FollowSymLinks RewriteEngine on RewriteRule index/LodgeID/(.*)/ index.php?LodgeID=$1 RewriteRule index/LodgeID/(.*) index.php?LodgeID=$1 这就是重写: 致: 我已经解决了图像和CSS文件的路径问题 我想能够做的是在URL中包
Options +FollowSymLinks
RewriteEngine on
RewriteRule index/LodgeID/(.*)/ index.php?LodgeID=$1
RewriteRule index/LodgeID/(.*) index.php?LodgeID=$1
这就是重写:
致:
我已经解决了图像和CSS文件的路径问题
我想能够做的是在URL中包含一个旅馆名称的变体
我在lodges表中有一个字段,该字段有一个可以使用的短名称字符串,例如:
非洲马背鱼
是否可以使用“重写URL”来:
http://lodges.goodsafariguide.com/[i] lodgename[/i]/
如果“lodgename”作为字段存储在与LodgeID相同的lodges表中?只要您有办法获取短名称字符串并将其映射到index.php中的正确lodge(或lodge ID),就可以执行以下操作:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?LodgeName=$1 [L,QSA]
因此,如果请求是针对
http://lodges.goodsafariguide.com/africanhorsebacksafaris
,它将被重写为:/index.php?LodgeName=africanhorsebacksafaris
,我只想说我现在正在处理这些问题:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/ index.php?GSG_URL=$1
我在.htaccess文件中添加了:RewriteRule index/(.*)/index.php?GSG_URL=$1 RewriteRule index/(.*)index.php?GSG_URL=$1。这给了我:我尝试了:RewriteRule(.*)/index.php?GSG_URL=$1 RewriteRule(.*)index.php?GSG_URL=$1:但它不喜欢这样,也没有显示任何数据。语法中是否有调整,还是总是需要引用.php页面?