Nirali Kavar
Nirali Kavar

Reputation: 986

Rewrite url using .htaccess in php not working

I want rewrite below url

http://www.example.com/page.php?n=About%2BUs&id=F534Z531G538

to

http://www.example.com/about-us

using .htaccess file. i have tried below code in my .htaccess

Options +FollowSymlinks
RewriteEngine on
rewriterule ^page.php?n=About%2BUs&id=F534Z531G538(.*)$ http://www.example.com/about-us$1 [r=301,nc]

but this is not working and also id is randomly generate.

anyone can help me ?

Upvotes: 0

Views: 229

Answers (1)

Niroj Adhikary
Niroj Adhikary

Reputation: 1835

try this

 RewriteRule ^about-us/([a-zA-Z0-9]+)$ page.php?id=$1

for http://www.example.com/about-us/f14dfa

for http://www.example.com/about-us

 RewriteRule ^about-us$ page.php

Upvotes: 2

Related Questions