1

I have a URL

www.domain.com/catalog.php?category_title=widgets

I want to mod_rewrite it to

www.domain.com/widgets/

I've tried

RewriteEngine On
RewriteRule /([^/.]+)/[?]*[^\/\.]*$ /catalog.php?category_title=$1

So I'm searching for /([^/.]+)/

The [?]*[^\/\.]* part is so that the page can work with Google Adwords which appends a query string to the flat URL.

This regex worked on a a previous implementation using Zeus's Request Rewrite Module which is their proprietary version of mod_rewrite.

This is my first go at Apache mod_rewrite, and I can't get this to work.

4

1 回答 1

2

尝试使用:

RewriteEngine On
RewriteRule ^([^/]*)/$ /catalog.php?category_title=$1 [L]
于 2013-04-25T09:41:15.420 回答