Welcome to WebmasterWorld Guest from 54.144.79.200

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

My Site Internal Server Error

I think there is some problem in my .htaccess

     

sweetguyzzz

7:53 am on Mar 1, 2011 (gmt 0)

5+ Year Member



Options +FollowSymLinks
RewriteEngine On

#For redirect user to www.example.com if they ask for example.com
RewriteCond %{http_host} ^example.com [nc]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,nc]


#REDIRECTION OF OLD PAGES STARTs FROM HERE
#All Categories index pages is redirecting
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /01-funny-images/pictures-of-funny-([1-3]).php[?]?[^\ ]*\ HTTP/
RewriteRule ^01-funny-images/pictures-of-funny-([1-3]).php$ http://www.example.com/funny/index-$1.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /03-info-gallery/info-gallery-([1-2]).php[?]?[^\ ]*\ HTTP/
RewriteRule ^03-info-gallery/info-gallery-([1-2]).php$ http://www.example.com/gallery/index-$1.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /02-funny-videos/super-funny-videos-1.php[?]?[^\ ]*\ HTTP/
RewriteRule ^02-funny-videos/super-funny-videos-1.php$ http://www.example.com/videos/index.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /04-short-jokes/hilarious-short-jokes-1.php[?]?[^\ ]*\ HTTP/
RewriteRule ^04-short-jokes/hilarious-short-jokes-1.php$ http://www.example.com/jokes/index.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /05-short-stories/complete-short-stories-1.php[?]?[^\ ]*\ HTTP/
RewriteRule ^05-short-stories/complete-short-stories-1.php$ http://www.example.com/stories/index.html? [R=301,L]


#All categories subpages are redirecting
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /01-funny-images/([^.]+).php[?]?[^\ ]*\ HTTP/
RewriteRule ^01-funny-images/([^.]+).php$ http://www.example.com/funny/$1.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /02-funny-videos/([^.]+).php[?]?[^\ ]*\ HTTP/
RewriteRule ^02-funny-videos/([^.]+).php$ http://www.example.com/videos/$1.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /03-info-gallery/([^.]+).php[?]?[^\ ]*\ HTTP/
RewriteRule ^03-info-gallery/([^.]+).php$ http://www.example.com/gallery/$1.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /04-short-jokes/([^.]+).php[?]?[^\ ]*\ HTTP/
RewriteRule ^04-short-jokes/([^.]+).php$ http://www.example.com/jokes/$1.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /05-short-stories/([^.]+).php[?]?[^\ ]*\ HTTP/
RewriteRule ^05-short-stories/([^.]+).php$ http://www.example.com/stories/$1.html? [R=301,L]


#All main pages are redirecting
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /06-main-pages/contact-us.php[?]?[^\ ]*\ HTTP/
RewriteRule ^06-main-pages/contact-us.php$ http://www.example.com/main/contact.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /06-main-pages/hilarious-funny.php[?]?[^\ ]*\ HTTP/
RewriteRule ^06-main-pages/hilarious-funny.php$ http://www.example.com/main/extreme-funny.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /06-main-pages/link-exchange.php[?]?[^\ ]*\ HTTP/
RewriteRule ^06-main-pages/link-exchange.php$ http://www.example.com/main/link-exchange.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /06-main-pages/link-exchange-directory.php[?]?[^\ ]*\ HTTP/
RewriteRule ^06-main-pages/link-exchange-directory.php$ http://www.example.com/main/links-directory.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /06-main-pages/privacy-policies.php[?]?[^\ ]*\ HTTP/
RewriteRule ^06-main-pages/privacy-policies.php$ http://www.example.com/main/privacy-policies.html? [R=301,L]


#Redirect GBOT to other sitemap
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /06-main-pages/site-map.xml[?]?[^\ ]*\ HTTP/
RewriteRule ^06-main-pages/site-map.xml$ http://www.example.com/main/sitemap.xml? [R=301,L]





#Redirect to index.html when ask for index.php
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^.]+)/?[^\ ]*\ HTTP/
RewriteRule ^([^.]+)/$ http://www.example.com/$1/index.html? [R=301,L]

#Redirect main/page-name.html to the variable of $cat and $page so in page get this variable
RewriteRule ^main/([^.,^/]+)\.html$ /index.php?cat=main&page=$1 [L]

#Redirect funny/index.html to the variable of $cat so in page get this variable
RewriteRule ^([funny,videos,gallery,jokes,stories]+)/index\.html$ /index.php?cat=$1 [L]

#Redirect funny/index-2.html to the variable of $cat and $page_no so in page get this variable
RewriteRule ^([funny,videos,gallery,jokes,stories]+)/index\-([0-9]*)\.html$ /index.php?cat=$1&page_no=$2 [L]

#Redirect funny/id-page-name.html to the variable of $cat, $page_id and $page_link so in page get this variable
RewriteRule ^([funny,videos,gallery,jokes,stories]+)/([0-9]*)\-([^.,^/]+)\.html$ /index.php?cat=$1&page_id=$2&page_link=$3 [L]

#Redirect funny/page-name.html to the variable of $cat and $page_link so in page get this variable
RewriteRule ^([funny,videos,gallery,jokes,stories]+)/([^.,^/]+)\.html$ /index.php?cat=$1&page_link=$2 [L]

#Giving all php pages html extension
RewriteRule ^(.*)\.html$ $1.php [L]



Hi,

Above is my .htaccess file code. Please tell what a error can be here in file which gives 500 Internal Server Error on my site.

Please reply as soon as possible as my site is stucked.

Thanks in Advance
sweetguyzzz

g1smd

10:25 am on Mar 1, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The code
#For redirect user to www.example.com if they ask for example.com

should be moved to be immediately after the code
#Redirect to index.html when ask for index.php



This code does not do what the comment says it should.
#Redirect to index.html when ask for index.php
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^.]+)/?[^\ ]*\ HTTP/
RewriteRule ^([^.]+)/$ http://www.example.com/$1/index.html? [R=301,L]



You should NOT redirect to index.html. You should redirect both index.html and index.php to "/".

The canonical URL for the site root should be "www.example.com/" and for a folder should be "example.com/folder/".

sweetguyzzz

2:34 pm on Mar 1, 2011 (gmt 0)

5+ Year Member



Hi g1smd,

Thanks for your very fast response.

When I posted this thread my site was giving the error of 500 Internal Server. I know this error means there is something wrong with .htaccess so I uploaded my backup .htaccess to the web but problem was not solved then I posted here. When I get your reply, I did not apply any changes and just to check my web I open it and that error does not shown. Now I am in confusion that what thing causes that problem and also solves it.

Can you tell me what the thing is behind this and what changes I must do to get away from this error.

Waiting for your reply.

Thanks
 

Featured Threads

Hot Threads This Week

Hot Threads This Month