Forum Moderators: phranque
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.More information about this error may be available in the server error log.
I'm just trying simple codes just to try and get it working but I really need a lot of redirecting rules to be set.
Here's my .htaccess file just incase I'm doing something wrong:
RewriteEngine on
RedirectPermanent folder/index.htm [mydomain.com...]My domain isn't going to be changing, just the folders and files inside it. Here's an example of what I want to do after I can get the 301 working:
Change:
•mydomain.com/tutorials/photoshop to mydomain.com/v2/adobe-photoshop
•mydomain.com/tutorials/photoshop/photographic_effects to mydomain.com/v2/adobe-photoshop/photographic-effects/
•mydomain.com/tutorials/photoshop/photographic_effects/tutorial_name/ to mydomain.com/v2/adobe-photoshop/photographic-effects/tutorial-name.html
•mydomain.com/tutorials/photoshop/photographic_effects/tutorial_name/index.htm to mydomain.com/v2/adobe-photoshop/photographic-effects/tutorial-name.htmland so on for every folder.
Redirect 301 /directory/file.htm [domain.tld...]
At the left a relative URL, at the right an absolute one.
No, the Redirect family of directives requires a full URL, because these directives produce an external redirect response.
What change caused your redirect to work?
It may be that you don't have permission to use mod_rewrite. If you put RewriteEngine on back in and your server starts getting the error again, then add an options statement, and try this:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^folder/index\.htm$ http://mydomain.com/v2/folder/filename.htm [R=301,L]
If it turns out that you're not allowed to use mod_rewrite, then you may be able to accomplish most of your goals using RedirectMatch [httpd.apache.org].
Jim
Sorry it's not working again. I dont really know what's going on, sometimes it gives me the error and sometimes it doesn't.
I just wrote hundreds of lines of redirect 301
I haven't tried the code you've suggested yet jdMorgan because I really hope that the one I already wrote works. It took along time to write it.
[edited by: jdMorgan at 4:57 am (utc) on Mar. 28, 2005]
[edit reason] Removed site URL. Please see TOS. [/edit]
redirect 301 / [mydomain.com...]
It goes to the same domain.. I just want to tell it to go to the v2 folder in the domain.
redirect 301 /folder1/folder2 [domain.com...]
redirect 301 /folder1/folder2/filename.htm [domain.com...]
The 2nd line doesnt run because it executes hte first line first.
it gives me a looping effect?redirect 301 / http://mydomain.com/v2
Yes, it will. The Redirect directive uses prefix-matching. So any requested URL that starts with a slash will be redirected to /v2, including /v2 itself.
The problem is that there's no 'pretty' way to fix this without mod_rewrite or server config access. An ugly way to fix it might be:
RedirectMatch ^/([^v][^2]?.*)$ http://mydomain.com/v2/$1
Is there anyway to get around this?redirect 301 /folder1/folder2 http://domain.com/v2/folder1/folder2
redirect 301 /folder1/folder2/filename.htm http://domain.com/v2/folder1/folder2/filename.htmThe 2nd line doesnt run because it executes hte first line first.
Again, this is because of prefix-matching.
Reverse the order of the two directives -- Always put your most-specific directives first. Or use RedirectMatch instead of Redirect.
Jim
Heres the script that doesnt work. The 2nd line will run but the 3rd line will end up something like this [domain.com...]
redirect 301 /tutorials/photoshop/photo_retouching/auto_white_balance/index.htm [fotofects.com...]
redirect 301 /tutorials/photoshop/photo_retouching [fotofects.com...]
It's not too important to get that link working so if it's too much work to figure out how to do it, then it's fine.
For example, this one line:
RedirectMatch 301 ^/tutorials/photoshop/fractals/([^_]+)_([^/]+)/index.htm$ http://example.com/v2/adobe-photoshop/fractals/$1-$2.html
#Redirect 301 /tutorials/photoshop/fractals/florid_paint/index.htm http://example.com/v2/adobe-photoshop/fractals/florid-paint.html
#Redirect 301 /tutorials/photoshop/fractals/lace_flower/index.htm http://example.com/v2/adobe-photoshop/fractals/lace-flower.html
#Redirect 301 /tutorials/photoshop/fractals/liquified_kaleido/index.htm http://example.com/v2/adobe-photoshop/fractals/liquified-kaleido.html
#Redirect 301 /tutorials/photoshop/fractals/ornate_rug/index.htm http://example.com/v2/adobe-photoshop/fractals/ornate-rug.html
#Redirect 301 /tutorials/photoshop/fractals/powdered_butterflies/index.htm http://example.com/v2/adobe-photoshop/fractals/powdered-butterflies.html
#Redirect 301 /tutorials/photoshop/fractals/rectangular_slinky/index.htm http://example.com/v2/adobe-photoshop/fractals/rectangular-slinky.html
#Redirect 301 /tutorials/photoshop/fractals/scaling_boxes/index.htm http://example.com/v2/adobe-photoshop/fractals/scaling-boxes.html
#Redirect 301 /tutorials/photoshop/fractals/spoked_tunnel/index.htm http://example.com/v2/adobe-photoshop/fractals/spoked-tunnel.html
#Redirect 301 /tutorials/photoshop/fractals/translucent_feather/index.htm http://example.com/v2/adobe-photoshop/fractals/translucent-feather.html
#Redirect 301 /tutorials/photoshop/fractals/webbed_flower/index.htm http://example.com/v2/adobe-photoshop/fractals/webbed-flower.html
The trick is to take your current Rewrite directives and sort them first alphabetically, and then by the number of "variables" in the URL. Putting them in some kind of order will allow you to find "shortcuts" like the one I used above.
Jim