由于坏的htaccess导致500内部错误

时间:2013-12-14 09:01:53

标签: php apache .htaccess mod-rewrite

我必须将我的网站移动到另一个托管。当我的网站被移动时,它会给我500个内部错误消息。最初我认为托管服务器出了问题。然后我在演示服务器上上传了我的网站。我遇到了相同的错误信息。我谷歌并导致它与htaccess文件有些不对。我回到我的服务器。移除htaccess并且错误消失了。和魔法引号在htaccess的顶部。 现在问题是我不知道htaccess。它有什么问题。我已经更改了它中给出的路径名称。任何想法都可以通过htaccess或写下新的htaccess。

  ErrorDocument 404 http://my_site_name/
  php_value magic_quotes on
  php_value default_charset iso-8859-1

  RewriteEngine on


  # CANONICAL HOSTNAMES #
  RewriteCond %{HTTP_HOST}   !^www\.my_site_name\.com [NC]
  RewriteCond %{HTTP_HOST}   !=""
  RewriteRule ^/?(.*)        http://my_site_name/$1 [L,R=301]

  # any capitialized chars will be redirected to the lowercase version
  ### this goes in httpd.conf -> RewriteMap  lc int:tolower
  RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|css|js|html)$
  RewriteCond %{REQUEST_URI} [A-Z]
  RewriteRule ^[\/]*(.*)$ /${lc:$1} [R=301,L]

  # any url starting with /home will be redirected to the default homepage /
  RewriteRule ^home http://my_site_name/ [L,R=301]

  # any url with ?page=xyz will be redirected to /xyz
  RewriteCond %{QUERY_STRING} page=(.*)
  RewriteRule ^/?.* http://my_site_name/%1? [L,R=301]


  #if file exists, then bypass rewrite rules (.css, .js, etc need this to be found)
  RewriteCond %{REQUEST_URI} \.(gif|jpg|png|css|js|xml|html)$
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d  
  RewriteRule .* - [L]

  RewriteRule ^locations/search/(.+)$ index.php?rwurl=find_listing&keyword=$1&methodName=KeywordSearch [NC,L]

  # NEW LOCATION REWRITE URLS               
  RewriteRule ^locations/?$ index.php?rwurl=find_listing&methodName=CountryList [N C,L]
  RewriteRule ^locations/.+/.+/[a-z]{2}/(.+)/c([0-9]+)sp([0-9]+)c$ index.php?rwurl=find_listing&country_id=$2&statprov_id=$3&city=$1&methodName=PropertyList_City [NC,L]
  RewriteRule ^locations/.+/.+/[a-z]{2}/c([0-9]+)sp([0-9]+)$ index.php?rwurl=find_listing&country_id=$1&statprov_id=$2&methodName=PropertyList_StatProv [NC,L]
  RewriteRule ^locations/.+/c([0-9]+)$ index.php?rwurl=find_listing&country_id=$1&methodName=StatProvList [NC,L]

 # pet-friendly-vacation-rentals: if referred from pfvr, rewrite regular listings url to pfvr url
 RewriteCond %{http_referer} pet-friendly-vacation-rentals
 RewriteRule ^listings/.+/.+/[a-z]{2}/(.+)/c([0-9]+)sp([0-9]+)c([0-9]+).html$ index.php?rwurl=pet-friendly-vacation-rentals&crvpid=$4 [QSA,NC,L]

  # campgrounds-and-rv-parks: if referred from crvp, rewrite regular listings url to crvp url
  RewriteCond %{http_referer} campgrounds-and-rv-parks
  RewriteRule ^listings/.+/.+/[a-z]{2}/(.+)/c([0-9]+)sp([0-9]+)c([0-9]+).html$ index.php?                            rwurl=campgrounds-and-rv-parks&crvpid=$4 [QSA,NC,L]

0 个答案:

没有答案