.htaccess RewriteRule issue here
Ok, so I am using this code in a .htaccess file. This is the only code in there, but it doesn't seem to work at all and I know I have mod_rewrite installed and enabled.
RewriteEngine On
RewriteRule ^news\.js news.php [NC]
have also tried this:
RewriteEngine On
RewriteRule news.js news.php [NC]
Ok, so, I am using news.php to output a JS Script that I am linking to elsewhere. So I开发者_C百科 want all links to news.js (and all links with text after this), to point to news.php instead. And so news.php outputs the Javascript for this, but is a PHP file...
Am I setting up the PHP file correctly?
<?php
// If there is a php error for any reason...hide it!
ini_set('display_errors', 'Off');
// Set the header-type.
header('Content-type: application/x-javascript');
// And it calls some functions in here
?>
The problem is that it isn't working. Can someone please help me? Is my .htaccess file not set up properly?
Thanks for any help you can offer me.
do you have AllowOverride enabled for your .htaccess to work? http://www.blackbeagle.com/web-hosting/apache-mod_rewrite-and-allowoverride/
精彩评论