开发者

.htaccess seo rewrite

开发者 https://www.devze.com 2023-02-06 11:36 出处:网络
my current setup is: site.com/DI开发者_开发问答R/56 what I want to do is: site.com/DIR/56/some-string-here-about-the-page

my current setup is:

site.com/DI开发者_开发问答R/56

what I want to do is:

site.com/DIR/56/some-string-here-about-the-page

my current .htaccess setup is:

RewriteEngine on
Options +Followsymlinks
RewriteRule ([0-9]+) index.php?id=$1


I'm not an .htaccess expert, but it seems to me your existing setup will work. What it is doing is taking the uri given and finding an integer inside it -- anywhere inside it. It then ignores all the other text in the uri, by rewriting it as index?id=$1. $1 is simply the integer found, for example, 56.

You could be more explicit and try something like this:

RewriteEngine on
Options +Followsymlinks
RewriteRule DIR\/([0-9]+)(\/)? index.php?id=$1

However, I'm reasonably sure your fancy-urls will work correctly without any change.

0

精彩评论

暂无评论...
验证码 换一张
取 消