Addy
Addy

Reputation: 1080

How to add redirection rule using htacess?

I am trying to write htaccess redirection rule for redirect url from 'abc.com/xyz' to 'abc.com/t1=xyz'. But rule not working.

RewriteEngine On
#RewriteRule ^xyz$ /?t1=xyz [L]

Please help me on this.

1.) abc.com/xyz output abc.com?t1=xyz
2.) abc.com/xzzz output abc.com?t1=xzzz

value after domain is not fixed this can be changed. Anything after domain should be value of t1 after redirection

Upvotes: 2

Views: 53

Answers (1)

RavinderSingh13
RavinderSingh13

Reputation: 133640

Could you please try following, written as per your shown samples. Please make sure you clear your browser cache before testing your URLs.

RewriteEngine ON
RewriteCond %{REQUEST_URI} !^/?$
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)/?$ ?t1=$1 [L]

Upvotes: 2

Related Questions