Howto redirect or forward a link / url via .htaccess

If you want to redirect / forward a link / url the easiest solution is to use a .htaccess file. You need to place it in the directory where the user would normally land with the original link.

The general structure is simple. You´ll only need to enter one single line in the .htaccess file:

Redirect permanent old location new location

  • old location must be a relative link to root of your server structure, e.g. /wwwroot/index.html
  • new location must be a full link, e.g.  http://www.yoursite.de/index.html

So in case you want to redirect http://www.mysite.com/index.html to http://www.my-new-site.com/index.html your .htaccess file needs to be placed in the same directory where the index.html is and should look like this:

Redirect permanent /wwwroot/index.html http://www.my-new-site.com/index.html

If you want to redirect something like this http://www.mysite.com/uploads/12/myuploadedfile.rar to this new location http://www.my-new-site.com/download/myuploadedfile.rar then your .htaccess file needs to be placed in the “12” directory and should look like this:

Redirect permanent /wwwroot/uploads/12/myuploadedfile.rar http://www.my-new-site.com/download/myuploadedfile.rar

Remember: The /wwwroot/ can be different on your site / server. You need to find out the webservers document root. A common directory is also /public_html/.

Thx to the RBI @ Uni Frankfurt – see their site for more information about url redirecting (only in german).

 

The uploaded file could not be moved to – WordPress 3.3.1

Update – 25.01.2012

I still haven´t found a good solution for the problem. Several people report that they were able to solve it , by changing the owner of the “uploads” directory (to the user which php runs as (in most cases “wwwrun”). But that didn´t worked for me. The only solution I found was to run php as FastCGI and not as an Apache module. This solution though has some drawbacks. You need to configure a single php.ini for every virtual host you run and you can´t use .htaccess files anymore.

My conlusion – FastCGI resolves the problem but doesn´t cure the root of all that evil.

I guess the WordPress 3.3 and 3.3.1 are the worst releases the WordPress Team ever did. First the fucked up the visual editor and now the shittiest WordPress problem ever: “The uploaded file could not be moved to” – a problem occuring when you try to upload images/videos/media (and when your php runs in safe mode).

In older WordPress versions it could be easily solved by chmod 777 the “uploads” folder within “wp-content”. Now this doesn´t work anymore.

One solution is to chmod 777 “wp-content” completely. But they can´t be serious about that…can they ?

The long search for a Webmail Solution

Update: Comments have been disabled as being the no.1 source of spam.

Over the past years I have been using my providers (1&1) webmail solution. They had 2 versions of it. A very simple and old school one and a web 2.0 like styled newer one. The newer one had many features but was dead slow. The older one lacked nearly everything a modern webmail application has, but was quite fast. With the daily mail mass increasing and time to spare for it decreasing I decided that I need a new and better solution. First of all, I don´t like Google Mail. It has all the features I need (and dozens more which I don´t care about)  but I don´t like it. And I wanted my mails on my server. Nowhere else. Ritlabs – my favourite desktop e-mail client provider still has no web solution, only a portable version of their famous mail client The Bat. Not good for me, I need a web based solution.

I found a very good overview for webmail solutions at this site and believe me – I tried them all.

I had 4 assumptions for a PHP / MySQL / Apache based webmail solution:

  • easy to configure and install (web based, no hacking through 10 different config files)
  • secure (no register globals, safe mode, etc.)
  • multiple mail accounts per user
  • light and fast

AfterLogics WebMail Pro was the only solution that fullfilled 3 of my 4 assumptions. The one it lacked is that it only runs with PHP Safe Mode Off (hmm, not good but anyway…). All other products on the list had major flaws. Some didn´t run the installer or did anything at all (like Roundcube), some required to disable every single PHP security enhancement (like Hastymail) and others were way to difficult to configure (like Squirremail, or IMP out of the Horde Framework).

WebMail Pro has a very good installer (you only need to upload the files to your server, chmod one directory) that does everything on its own. It´s well explained and lets you test every single setting of your upcoming webmail solution. If you´re fast then installation needs about 2 minutes of time.

And the best thing is – normally you have to invest a lot of money for that solution (149$ for 25 user license). But if you keep it under 25 users and a single server install the pro version is for free. How great is that ? There´s also a light version available but in it you can´t add multiple mail accounts to a user. For all you IIS and .NET freakz there´s also am ASP.NET version available.

So – if you´re looking for great webmail solution – check it out !

All images and copyright http://www.afterlogic.com/webmail-client.

Update:

Not long after writing this article Webmail Pro confronted me with the first bug. I couldn´t attach a file to an e-mail. It only presented me Error #2038 – unknown error.

Luckily Afterlogic has a support forum where Igor (Afterlogic support) quickly presented a solution. It turned out that this problem only occurs when you´re using Webmail Pro with Firefox on a SSL connection. The following solution will disable the flash uploader and use instead the html one.

Here´s the solution:

1.) Go to the root path of your Webmail Pro installation

2.) Locate webmail.php and open it

3.) Look for a line that looks like this // flashInstalled = FLASH_NOT_INSTALLED;

4.) Remove // from that line (uncomment it) and save the file

5.) You´re done. Now you can attach files.

6.) In case you can´t find that line in the webmail.php locate flash-detect.php and open it

7.) Look for a line that looks like this // flashInstalled = FLASH_NOT_INSTALLED;

8.) Remove // from that line (uncomment it) and save the file

9.) You´re done. Now you can attach file.

Update 2:

Alex had a problem with sending mails, so I thought the solution might be in common interest. The image below shows the settings you have to adjust in the adminpanel of Afterlogic Webmail. The shown settings are for POP3 only, not IMAP. In my case the servers are those from 1&1.