user6494366
user6494366

Reputation:

.HTACCESS Dynamic URL Redirection

I have this URL format:

<A href="/Conversations?Nicholas_Carter">Nicholas Carter</A>

How can I redirect if someone types: /Conversations? to: /?Conversations

My current codes are:
for /Conversations?Nicholas_Carter

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ Conversations.php?with=$1 [L,QSA]

and for /?Conversations

RewriteCond %{QUERY_STRING} ^([^=]+)$ 
RewriteRule ^/?$ MainContents.php?page=%1 [L]

Upvotes: 1

Views: 33

Answers (1)

Amit Verma
Amit Verma

Reputation: 41249

To redirect /Conversations? to: /?Conversations you can use the following :

RewriteCond %{QUERY_STRING} .*
RewriteRule ^Conversation/?$ / [NC,L,R]

Upvotes: 1

Related Questions