I dont know what is wrong. I told ya I am a Win guy, Ask me about ASP/ .net mod_rewrite/nix is an alien thing to me. Whenever I try to put rewrite rules in .htaccess file it gives me 500 error. though 301 redirect working. What can I do now, it will ruin my SERP/PR.
Is this on a shared server or dedicated server hosted by a web hosting company, or do you have your own dedicated server in house? Many moons ago I had to edit an apache file for .htaccess stuff to work. I would get the Internal Server Error message with I tried .htaccess stuff. Post the 301 code that works. You can also try posting at *gags* webmasterworld.com/forum92/ The Apache King is there.
I am better away from WMW. I put this line in .htaccess to resolve the WWW and Non-WWW issue and it worked - redirect 301 / http://www.sitename.com/ But when i try to put this - Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^site.com [NC] RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301] It has given 500 Server error, I dont know what to do. I transfered the whole site back on the windows hosting, but its temporary. I have to transfer 5 of my sites on linux hosting, and the bad part is 3 of them are in ASP translated to PHP.
Next time you get off Windows again, try a simple... RewriteEngine on RewriteBase / RewriteRule ^wacko101$ index.php [L] test, just in case the first two lines were the cause. domain.com/wacko101 showing the index page. If that or the last test doesn't work, nothing will work. WMW might be your only hope. *gags*
What does it do? should I place it under site/Wacko101 dir or it would rename the index.php to wacko101 ??? Edit: I have just dropped a mail to support to ask whether mod_rewrite is supported on the server.
That's exactly the same at the last test with out the first two lines and with out a dot in the fake URL. domain.com/.htaccess (Same located at when the last test was made.) then domain.com/wacko101 would show da index page.
it worked, the test has worked. Edit: Damn it, The issue's resolved, the ASP page is redirecting to .htm pages Thanks a lot Ninno. You are da Man.errrrr....wacko Ninno Is there any way that I can rewrite .htm files as .asp?? or will it save my SERP/PR in da next update??
I've only registered to say a big thank you Nintendo. I've spent the last 48 hours trying to work out how to redirect my and absolutely no-one has been able to help me. After reading your post I managed to crack it in 2 minutes, which I think is amazing given that I've never used apache before or done any coding. Thanks again
Looks like it was just the first two lines in the first code that was 'destroying you'!! RewriteEngine on RewriteBase / RewriteRule ^(.*)\.html$ $1.asp [L] to let .asp URLs be .html Oh...mod_rewrite probably doesn't work on Windows and asp probably doesn't work on non-Windows!!! I think the redirect code is the only thing you can do RewriteEngine on RewriteBase / RewriteRule ^(.*)\.asp$ http://www.domain.com/$1.html [R=301,L]
Yepp that was the problem. they said that SymFollow was already activated, so there was no need to add that into the code. coz since it is already activated and when we tried to reactivate it, it trigered the server error. but Thanks a lot, it is solved and redirection is working now. Woohooo!!! And this worked too. U r da wacko, U r da wacko!!! done dona done
Hi thanks for a great guide. I've used it to crack problems with moving my blog -even though I had no previous apache or even coding experience. Very well written. I need help with a rule. I need to rewrite the following which isn't working: # Redirect Old Searches RewriteRule ^blog?cmd=search&keywords=(.*)$ site/index.php?s=$1&submit= [R=301,L] The '?' in 'blog?cmd=search....' isn't a wildcard - it's actually part of the url. I think this is a problem as I think apache thinks it's a wildcard. How do I fix? Thanks in advance for any help. Everton
In my actual rule I have site in there. I put 'site' in this post as I'm not allowed to post urls yet as I've only just registered! It's the ? in the url to match that I think is causing the problem. Everton
A \ can be placed before any characters that might cause trouble. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^blog?cmd=search&keywords=([^.]+)$ http://www.domain.com/index.php?s=$1&submit= [R=301,L]
Thanks for this tutorial. I have searched Google forever trying to find a way that would work to fix my problem of all my indexed pages in search engines not working. I had moved my forums from the root / directory to /forums. None of the links found in Google would work. I finally found this and had never even thought to look here. I have used this site quite a bit but never thought the answer to this would be here. Nintendo you are great man. Its people like you that make sites like this great. Keep up the good work. The site is working great now. I have a second problem on a different site though. I used to run a phpnuke site that I converted to vbulletin. I have thousands of links to the site but they dont work anymore. I know I probably have no way to redirect those links to the correct threads or posts but is there a way to redirect the indexed pages like this http://clubtitan.org/postp6673.html to point to my vbulletin index http://www.clubtitan.org/forums thanks again. Josh
Nevermind after reading more and trying a few things I got it. Used this RewriteEngine on Options +FollowSymLinks RewriteCond %{HTTP_HOST} ^clubtitan\.org RewriteRule ^(.*)\.html$ http://www.clubtitan.org/forums [L] Thanks Josh
hey there... got your message but I guess I'm thick... is the answer yes or no... a 301 redirect = mod_rewrite? cheers! Johnny Mac
mod_rewrite is changing URLs. That's not 'mod_rewrite'. It's a 301 redirect, redirecting from an old to new URL. To make for example Google redirect the page rank to the new URL. 302 bad. 301 good.
Hi all, anybody help me? In my .htaccess file: RewriteRule ^search_car/(.*)--(.*)/(.*)--(.*)/(.*)--(.*)/(.*)--(.*)/(.*)--(.*)\.html$ /cgi-bin/goo_mobile/NEW/search_static/search_car_w.cgi?$1=$2&$3=$4&$5=$6&$7=$8&$9=$10 [L] I can't get $10 value (but $1 to $9 is OK)? Thanks for your help.