CyberD.org
C:\ Home » Blog » Tech » Broken .htaccess

Broken .htaccess

So I was adding some Project 2016 posts to the site this morning, when this ghastly thing appeared:

Internal Server Error

I refreshed. I waited. I went to work. I came back. I download my error_log and signed into my FTP server and poked around, and Googled, and found the problem! It was this:

Redirect 301 /about/log.html /about/faq.html#x-changelog

That should have been this:

Redirect 301 http://cyberd.org/about/log.html http://cyberd.org/about/faq.html#x-changelog

The smallest things, huh?

What's odd is that this simple redirect has been there for over a year now, and it's not until today it became a problem. Using relative links within .htaccess for regular redirect rewrites is apparently a no no, so instead of opting for one of the potential workarounds I decided to just add in the absolute path. And there you go. Refreshed the page, and it's working again! Sorry for the downtime.

In the process I also found this nifty little tool to validate my .htaccess, and here's some useful tricks too.

What I'd really like to know though is how to redirect to a page with a section ID in the URL - of which the number symbol is coincidentally also the symbol used to enclose code comments in .htaccess, for example the still broken but not site-breaking example above: http://cyberd.org/about/faq.html#x-changelog

I can redirect to the main page fine, but how in the world can I redirect to a specific section on said page without said part of said URL being commented out?! A small problem with no apparent solution.

But at least the site's working again.

Comments

Keep track of the discussion via rss? Read about comment etiquette? Or type in something below!
This was pretty damn interesting. And yet, nobody's spoken! Be the first!


The Comment Form

Your email address will not be published. Required fields are marked *

Your email is saved only to approve your future comments automatically (assuming you really are a human). ;) It's not visible or shared with anyone. You can read about how we handle your info here.

Question   Razz  Sad   Smile  Redface  Biggrin  Surprised  Eek   Confused   Cool  Mad   Twisted  Rolleyes   Wink  Idea  Neutral

Privacy   Copyright   Sitemap   Statistics   RSS Feed   Valid XHTML   Valid CSS   Standards

© CyberD.org 2022
Keeping the world since 2004.