|
Posted by Ed Mullen on 11/13/07 20:59
BootNic wrote:
> Ed Mullen <ed@edmullen.net> wrote:
> news:e7-dnTeEvLNua6ranZ2dnUVZ_v6rnZ2d@comcast.com:
>
>> Ed Mullen wrote:
>>> Jonathan N. Little wrote:
> [snip]
>>>> Very simple example...
>>>> .htaccess file
>>>>
>>>> RewriteEngine On
>>>>
>>>> RewriteRule ^(.*)\.html$ $1.php
>>>>
>>> Excellent. Thank you all. I do have the ability to edit the
>>> .htaccess file. I will go read more so as not to be quite as
>>> dangerous as I am now.
>>>
>> Well, that was interesting.
>>
>> Using the above RewriteRule I did a test. And the only way it works
>> is if I rename the calling .html file to .shtml. Which, obviously,
>> defeats the purpose.
>>
>> Is this something that can configured/over-ridden using the .htaccess
>> file? Or is it at the server configuration level (which I do not have
>> access to)?
>
> You could try to use RedirectMatch in your .htaccess:
>
> RedirectMatch 301 (?i)^(.*)\.html(.*)$ $1.php$2
>
Hmm. Everything seems to be working. I changed all the pages to .php.
and every link I've tried seems to be working just fine.
Except, now my custom error pages don't work. I left the .html error
pages on the server but I got the server's default 404 page instead of
mine. Then I thought, "Oh, right, dummy, change them to .php files!"
So I did. But I'm still getting the server's 401, 403 and 404 error pages.
My .htaccess file:
RedirectMatch 301 (.*)\.html$ http://edmullen.net$1.php
ErrorDocument 404 /404_error_not_found.php
ErrorDocument 403 /403_error_forbidden.php
ErrorDocument 401 /401_error_unauthorized.php
If I go to http://edmullen.net/bob.html, the server sends me to
http://edmullen.net/bob.php. Since that file doesn't exist, I get a 404
error but it isn't MY custom error page.
If I go to http://edmullen.net/bob.jpg I DO get sent to my custom 404
page since, obviously, there's no redirection of .jpg files.
Any ideas?
My brain hurts. I'm gonna go get a drink.
--
Ed Mullen
http://edmullen.net
http://mozilla.edmullen.net
http://abington.edmullen.net
I wonder how much deeper would the ocean be without sponges.
[Back to original message]
|