Having trouble with Mod Rewrite

I am just re-installed a script in a different directory and need to reconfigure the old links to the new directory structure. I am having trouble figuring it out and would be more than greatful for someone to help me out with this hopefully simple fix. Thanks!

From this –http://www.mysite.com/verylongdirectoryname/

to this –http://www.mysite.com/short/

There’s a couple of ways to do this, but the one you probably want is a HTTP 301 Redirect (which means that the content has been permanently moved, and browsers will redirect to the new location).

The top link on a Google of the subject is: this one, which details how to do a 301 Redirect a variety of different ways - you could have index.php in the old location do the redirect, or a .htaccess file.

Hopefully that’s enough to get you going! :slight_smile:

So in theory this should work by putting it in the root .htaccess file for my situation. I think I may still have something a little off because it doesn’t seem to be working quite yet. Any ideas?

RewriteRule ^longdirectoryname/?(.*) http://www.mysite.com/short/$1 [R=301,L]

That looks about right, but you might also need to turn on the URL rewriting engine (http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html - in short, RewriteEngine On).

Also make sure .htaccess FileInfo overrides are allowed (in an apache.conf file defining either the Directory or VirtualHost you’re running, AllowOverride FileInfo, see http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride)

mark,

arc is correct, mod_alias is the correct software to use on something so simple.

Regards,

DK

Thanks for all your help! I think everything is redirecting now like it should. I really appriciate your quick responses.