Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect with .htaccess

Status
Not open for further replies.
No, but you can do this:
Code:
ErrorDocument 404 /index.php
Then in /index.php, you can use the variable $_SERVER['REQUEST_URI'] which would contain the requested URI, in your case /file.html. //Daniel
 
I tried that but it didn't work. $_SERVER['REQUEST_URI'] returns /index.php instead of /file.html
 
That is odd, since it is working fine on my server... What version of PHP and Apache are you running? //Daniel
 
Are you using PHP as an Apache module, or as a CGI binary? I ask this because I have done just what danielhozac suggested many times and it has worked flawlessly. Please post the exact PHP code you are using, and perhaps the relevant portion of your httpd.conf file.

Anyway, if this for some reason still doesn't work, you can definitely use mod_rewrite to handle this problem. Let me know if you want any help with a rewrite rule. -------------------------------------------

PHP/Perl/SQL/Javascript --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top