WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Search Engines > Search Engine Optimization Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Search Engine Optimization Forum SEO is much easier with help from peers and experts! The WebProWorld SEO forum is for the discussion and exploration of various search engine optimization topics. Any non (engine) specific SEO or SEM topics should go here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-07-2008, 07:06 AM
inertia's Avatar
inertia inertia is online now
WebProWorld Veteran
 

Join Date: Apr 2006
Location: Lancaster, UK
Posts: 644
inertia RepRank 2
Default 500 server error from htaccess

Quick guys i need some help! Ive just added this .htaccess file to a site and now im getting a 500 internal server error.

Is there anything wrong with this???

Code:
RewriteEngine on
RewriteRule ^/index\.php$ http://www.domain.co.uk/ [R=301, L]
RewriteRule ^(.*)/index\.php$ http://www.domain.uk/$1/ [R=301, L]
Reply With Quote
  #2 (permalink)  
Old 05-07-2008, 07:07 AM
inertia's Avatar
inertia inertia is online now
WebProWorld Veteran
 

Join Date: Apr 2006
Location: Lancaster, UK
Posts: 644
inertia RepRank 2
Default Re: 500 server error from htaccess

By the way - its a linux server with apache.
Reply With Quote
  #3 (permalink)  
Old 05-07-2008, 07:51 AM
minstrel's Avatar
minstrel minstrel is offline
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: Ottawa, Canada
Posts: 3,620
minstrel RepRank 0
Default Re: 500 server error from htaccess

Try adding

Code:
Options +FollowSymLinks
before

Code:
RewriteEngine on
Then remove one of the ReWrite lines, probably the first one.

And you should only have one line terminating in ",L]
Reply With Quote
  #4 (permalink)  
Old 05-07-2008, 08:46 AM
inertia's Avatar
inertia inertia is online now
WebProWorld Veteran
 

Join Date: Apr 2006
Location: Lancaster, UK
Posts: 644
inertia RepRank 2
Default Re: 500 server error from htaccess

Cheers for the help minstrel. htaccess is not one of my strong points!

Would this code work the same?

Code:
redirect 301 /index.php  http://www.domain.co.uk
Reply With Quote
  #5 (permalink)  
Old 05-07-2008, 08:56 AM
minstrel's Avatar
minstrel minstrel is offline
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: Ottawa, Canada
Posts: 3,620
minstrel RepRank 0
Default Re: 500 server error from htaccess

Yes. That should work.
Reply With Quote
  #6 (permalink)  
Old 05-07-2008, 09:22 AM
inertia's Avatar
inertia inertia is online now
WebProWorld Veteran
 

Join Date: Apr 2006
Location: Lancaster, UK
Posts: 644
inertia RepRank 2
Default Re: 500 server error from htaccess

Can i just clear up something that I'm unclear of....?

All suggestions for getting rid of canonicalization advice given out on this forum suggests using mod rewrite to get rid of /index.php.

If the standard htaccess 301 code works as well then why is mod rewrite the suggested method?
Reply With Quote
  #7 (permalink)  
Old 05-07-2008, 09:56 AM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,648
wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: 500 server error from htaccess

I think it is the suggested method because it is often already being used to deal with www.domain.tld vs domain.tld issues, so adding two more rules is often easier to explain.

You can do both of your redirects with a more traditional approach, which I would recommend over mod_rewrite if you are not already using mod_rewrite for another purpose.

Redirect 301 /index.php http://www.domain.com/
RedirectMatch 301 /(.*)/index.php http://www.domain.com/$1/

This method avoids the extra overhead of enabling the rewrite engine. However, if you already use mod_rewrite to perform internal redirects (converting URLs to query strings in a way invisible to visitors and bots) you won't save any overhead since the engine is already activated. In that case you would just use whichever method you are more comfortable with.
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog
Reply With Quote
  #8 (permalink)  
Old 05-07-2008, 12:20 PM
inertia's Avatar
inertia inertia is online now
WebProWorld Veteran
 

Join Date: Apr 2006
Location: Lancaster, UK
Posts: 644
inertia RepRank 2
Default Re: 500 server error from htaccess

This code didnt work at all! Got me in trouble with the boss as well!

Code:
 redirect 301 /index.php http://www.domain.co.uk
Reply With Quote
  #9 (permalink)  
Old 05-07-2008, 01:48 PM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,648
wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: 500 server error from htaccess

What happens when someone tries to access the /index.php page with that redirect code in use? Still the error 500?
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog
Reply With Quote
  #10 (permalink)  
Old 05-08-2008, 05:57 AM
inertia's Avatar
inertia inertia is online now
WebProWorld Veteran
 

Join Date: Apr 2006
Location: Lancaster, UK
Posts: 644
inertia RepRank 2
Default Re: 500 server error from htaccess

It comes up with an error screen saying there a redirect error when you try the root URL. It works if you try it with the /index.php?
Reply With Quote
  #11 (permalink)  
Old 05-08-2008, 09:35 AM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,648
wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: 500 server error from htaccess

If you remove the redirect rule, does the root URL automatically redirect to the /index.php version? It is possible there is an opposite rule elsewhere that breaks the redirection that you are trying to do.
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog
Reply With Quote
  #12 (permalink)  
Old 05-09-2008, 03:22 AM
Manpasand's Avatar
Manpasand Manpasand is offline
WebProWorld Pro
 

Join Date: Sep 2003
Location: My WorkShop
Posts: 187
Manpasand RepRank 0
Default Re: 500 server error from htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*) http://www.domain.com/$1 [R=301,L]

Use to deal with www.domain.com vs domain.com canonicalization issues.
Reply With Quote
  #13 (permalink)  
Old 05-09-2008, 03:40 AM
Manpasand's Avatar
Manpasand Manpasand is offline
WebProWorld Pro
 

Join Date: Sep 2003
Location: My WorkShop
Posts: 187
Manpasand RepRank 0
Default Re: 500 server error from htaccess

Here is another sticky thread on canonicalization issue.
Reply With Quote
Reply

  WebProWorld > Search Engines > Search Engine Optimization Forum


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
500 internal server error stops googlebot crawling my site? internet-marketing-cr Search Engine Optimization Forum 10 01-18-2007 01:57 PM
Runtime Error - Line 1 - Error Syntex Error charms987 Graphics & Design Discussion Forum 6 07-29-2005 11:56 AM
Server Error 500 on PHP/MySQL site MarcieZoob Web Programming Discussion Forum 6 07-17-2005 06:02 AM
Setting up customized error page with .htaccess protection StephenGarcia Web Programming Discussion Forum 1 12-20-2004 06:07 PM
Dynamic site: Tackling 500 Http Server error lucks Graphics & Design Discussion Forum 2 05-13-2004 10:03 PM


Search Engine Friendly URLs by vBSEO 3.0.0