.htaccess URL-重写解决方案?

.htaccess URL-Rewrite solution?

我需要使用 .htaccess

重写我的 url

url是

http://www.domain.com/subfolder/search-brands/index.php/?q=Garment Bags&brand=traveler apos s choice

我希望它像这样工作

http://www.domain.com/subfolder/search-brands/Garment Bags/traveler apos s choice

有人能做到吗?非常感谢您的帮助!

您可以在 /subfolder/search-brands/.htaccess 文件中使用此代码:

RewriteEngine On
RewriteBase /subfolder/search-brands/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?q=&brand= [L,QSA]