Reputation: 818
i am using htaccess for dynamic url rewriting. i want to show the test.php as test.html
the htaccess code is
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ $1.php [nc]
after running test.php, the browser show test.php on address bar. but if i change test.php as test.html the page give the same content. my apache config file are fine. how can i solve this? thanks to help me..
Upvotes: 2
Views: 374
Reputation: 73
You cant deny access to your .php
Yon need to put in your a tag the html link and it will go to php in the background.
If you still want to sow only the html address you can put regex in your php file and check if the extension is php. if so redirect the page to html.
example:
<?php
$temp = $_SERVER['PHP_SELF'];
$temp = explode('.', $temp);
if($temp[count($temp)-1] == "php"){
header("Location: test.html", true, 301);
}
?>
* not tasted !!! *
Upvotes: 1