Jayesh Ambali
Jayesh Ambali

Reputation: 221

htaccess rewrite a specific url to another specific url

I am trying to create a htaccess rewrite for achieving following

I have a url like this http://www.example.com/directory/test.php and wanted to show the contents of this page when http://www.example.com/directory/test.html

I tried following but did not work. Could anyone please let me know what I am doing wrong here

 RewriteEngine On
 RewriteBase /directory/ 
 RewriteCond ^directory/test.html/?$ [NC]
 RewriteRule ^(.*)http://www.examle.com/directory/test.php [NC,L]

Any help would be appreciated

Upvotes: 1

Views: 9713

Answers (1)

Croises
Croises

Reputation: 18671

You can use:

RewriteEngine On
RewriteRule ^directory/test\.html/?$ directory/test.php [NC,L]

Upvotes: 4

Related Questions