hellomello
hellomello

Reputation: 8597

trying to rewrite url in htaccess

I have url

http://www.url.com/business/index.php?biz=andrewliu

I'm trying to accomplish so it will be

http://www.url.com/business/andrewliu

I tried to have this:

RewriteRule ^/?([a-z0-9_-]+)/?$ /index.php?biz=$1 [L]

or

RewriteRule ^/?([a-z0-9_-]+)/?$ /business/index.php?biz=$1 [L]

doesn't work?

Help me?

Edit:

I have this

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 

prior to the rewriterule

Upvotes: 0

Views: 96

Answers (3)

rekire
rekire

Reputation: 47975

That depends in which directory your .htaccess file is.

For the root directory try this one:

RewriteRule ^/?business/([a-zA-Z0-9_-\.]+)/?$ /business/index.php?biz=$1 [L]

If your .htaccess file is in the business directory that of your statments should work fine:

RewriteRule ^/?([a-zA-Z0-9_-\.]+)/?$ /index.php?biz=$1 [L]

Upvotes: 1

kmoser
kmoser

Reputation: 9308

It's not clear from your examples whether you want "biz" or "business" or "b". I'm taking a guess that you want "biz", in which case your rule should be:

RewriteRule business/(.*) /index.php?biz=$1 [L]

Or maybe you want:

RewriteRule ([^\/]*)/(.*) /index.php?$1=$2 [L]

Upvotes: 0

Andrew Vaughan
Andrew Vaughan

Reputation: 234

RewriteRule ^business/([_0-9a-zA-Z-]+)/?$ business/index.php?b=$1 [L]

Upvotes: 0

Related Questions