There remains for us only the very narrow way, often extremely difficult to find, of living every day as though it were our last, and yet living in faith and responsibility as though there were to be a great future...

-- Dietrich Bonhoeffer

You may contact me at:

info@technotheologian.us

Custom Search

 

October 2008
M T W T F S S
« Sep   Nov »
 12345
6789101112
13141516171819
20212223242526
2728293031  
Please note: The views expressed on this blog are mine unless noted, and do not reflect the views of my employer or church.

Rewriting backslashes on Apache

I was having a problem after transitioning from a Windows server for websites, to a Linux server. Some of the links to files on the site were broken, because they had a backslash in the url, instead of a forward slash. I struggled with this issue for some time, and wanted to present how I fixed it in case others are searching for this solution too.

1. First, make sure that mod_rewrite is loaded in Apache.

2. Make sure that in the tag for the website, that AllowOverrideis set to All.

3. In the root directory of your website, create a file named .htaccess with the following lines:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)\\(.*)$ $1/$2

This should fix the problem.

Why would you have to do this? The website on my server in question is one that is maintained by other people. Because they use Windows systems, and aren’t aware of the forward and backslash issues with files, it would be too difficult to try and change their code. In a perfect world, this shouldn’t need to be done, but it is handy for those who develop on the windows platform.

I couldn’t find this kind of checklist anywhere on the net, but bits and pieces of this were taken from other sources. Specifically, the Rule was found here.

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>