Adrien Hingert
Adrien Hingert

Reputation: 1516

.htaccess redirection with non existant folder

I need to redirect the following two URLs as shown:

http://domain.com/folder/file.php -> http://domain.com/folder2/
http://damain.com/folder/file2.php?id=13 -> http://domain.com/folder2/

Normally I would have used something like:
RewriteRule ^/folder/file\.php /hackme/ [R]

But it seems that, as "folder" does not exist, the redirection cannot take pleace. Can somebody help me figure out how to do this please?

Upvotes: 2

Views: 700

Answers (1)

Oussama Jilal
Oussama Jilal

Reputation: 7739

I think you are looking for this :

RewriteEngine on

RewriteBase /

RewriteRule ^folder/file\.php folder2/ [L,R=301]

RewriteCond %{QUERY_STRING} ^id=13$
RewriteRule ^folder/file2\.php folder2/ [L,R=301]

Upvotes: 1

Related Questions