如何写.htaccess虚荣URL

时间:2014-10-20 06:00:44

标签: apache .htaccess url redirect vanity-url

我已经写了一个.htaccess虚荣网址重定向到用户部落(或大多数人可能会调用该功能的组),所以我没有将域名作为域名运行的域名.groups / clan.php?id = something的.com /东西

现在我想要的是帖子而不是domain.com/groups/view_update.php?pid=post_id我想要domain.com/soomething-group-name/posts/post_id

如果我难倒,我该怎样归档?

这是我的代码:

RewriteEngine On

# Make sure you only match on files/directories that don't actually exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite the first part after the `/` into a `username` parameter

RewriteRule ^(.+)$ groups/index.php?gname=$1 [L,QSA]

谢谢负荷:)

0 个答案:

没有答案