I have:
RewriteEngine on
RewriteBase /root/dir1/dir2/
RewriteRule ^file.php test.html [T=application/x-httpd-cgi,L]
which I have basically put together according to other posts and I don't claim to fully understand it.
.htaccess resides in directory dir2
Currently the page returned is a 500 internal server error. I have tried writing different bits for rewriteBase (should this be relative to the position of .htaccess or from the root?) and rewriteRule.
Help would be greatly appreciated :)
Risky
RewriteEngine on
RewriteBase /
RewriteRule ^fred.html nohead.html
That should substitute a call to "nohead.html" from a call to fred.html.
make sure both files exist and have unique content (so you can tell which is really being served). Then try to call fred.html in the browser and see what happens. From there, it is just a matter of tweak the paths and files, but you need to make sure mod_rewrite is up and running first.
I set up the files exactly as you suggested - called fred just to make sure and then saved the .htaccess to that directory. This resulted in an internal server error again.
I guess that I am unable to use mod_rewrite. I am going to have a word with the administrator to see if he understands what I am trying to do. Is it possible for me to check whether I have rights to use this command?
First, I set up and ran a "^fred.html nohead.html" test and the redirect worked -- that is, I asked for fred.html and got the content of nohead.html instead. I did this with two servers, one using Apache with Solaris, and the other using Apache with Linux.
Second, I created a plain-text file containing only the line:
<?php phpinfo(); ?>
and I named it "phpinfo.php"
Then on both servers, when I requested phpinfo.php, I got long pages with the on-page titles of "PHP Version 4.2.1" and "PHP Version 4.1.2"
However on neither of these pages can I find any mention of "mod_rewite" or "LoadedModuals". So, please tell me the exact phrase I should be looking for. Thank you.
PHP Version 4.1.2
PHP 4.0 Credits
Configuration
PHP Core
xml
standard
session
posix
pcre
mysql
gd
ftp
dba
bcmath
zlive
Additional Modules
environment
php variables
php license
The word "apache" only appears 3 times on this page in
environment:
SERVER_SOFTWARE Apache/1.3.26 (Unix)
php variables:
_SERVER["SERVER_SOFTWARE"] Apache/1.3.26 (Unix)
_ENV["SERVER_SOFTWARE"] Apache/1.3.26 (Unix)
Am I looking at the wrong page? Did I put the file I created in the wrong directory? Here is where I put it:
http*//my-domain/phpinfo.php
As to mod_rewrite, that was the point of the "^fred.html nohead.html" test, wasn't it? And since that test is positive on this server, mustn't mod_rewrite be available on this server?