Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simple .htaccess redirect : how to redirect with parameters?

My goal is simply to redirect:

/jsn.php?parameters to http://www.site2.com/jsn.php?parameters

I tried with

Redirect permanent /jsn.php(.)* http://www.site2.com/jsn.php$1
like image 362
yarek Avatar asked May 24 '12 22:05

yarek


People also ask

What is a 301 .htaccess redirect?

A 301 Permanent Redirect permanently redirects one URL to another. You set up a 301 redirect using . htaccess to send visitors to a new URL and tell search engines that a page has moved so that the new page can be properly indexed. Some common uses of a 301 redirect with .

What is rewrite rule in htaccess?

htaccess rewrite rules can be used to direct requests for one subdirectory to a different location, such as an alternative subdirectory or even the domain root. In this example, requests to http://mydomain.com/folder1/ will be automatically redirected to http://mydomain.com/folder2/.


1 Answers

Query string parameters are automatically passed, you simply want to do this:

Redirect permanent /jsn.php http://www.site2.com/jsn.php

The (.)* doesn't work with the Redirect directive, you were probably thinking of RedirectMatch, but either way, you don't need it. And also (.)* should be (.*), otherwise the $1 backreference would only get the first character.

like image 151
Jon Lin Avatar answered Oct 12 '22 15:10

Jon Lin