当我尝试忽略来自Facebook抓取工具的请求时,我收到内部服务器错误

时间:2015-12-15 12:30:32

标签: facebook .htaccess

我想让Facebook抓取工具忽略重定向,因为我想显示并喜欢/分享http链接。

我有这个.htaccess代码:

##
# @package      Joomla
# @copyright    Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
# @license      GNU General Public License version 2 or later; see LICENSE.txt
##

##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
##

# permanently redirect from www domain to non-www domain



RewriteEngine on
Options +FollowSymLinks


#
# HTTPS Redirect

RewriteCond %{HTTP_HOST} !^www\.atlantotec\.com$
RewriteRule ^(.*)$ https://www.atlantotec.com/$1 [L,R=301]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteRule ^(.*)=it$ http://www.atlantotec.com/it/$1 [R,NC]
RewriteRule ^(.*)=de$ http://www.atlantotec.com/de/$1 [R,NC]
RewriteRule ^(.*)=en$ http://www.atlantotec.com/en/$1 [R,NC]

#Header set Cache-Control "max-age=60"

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

########## Begin - ETag Optimization
## This rule will create an ETag for files based only on the modification
## timestamp and their size. 
## Note: It may cause problems on your server and you may need to remove it
FileETag MTime Size
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
# Enable expiration control
ExpiresActive On
# Default expiration: 1 hour after request
ExpiresDefault "now plus 1 hour"
# CSS and JS expiration: 1 week after request
ExpiresByType text/css "now plus 1 week"
ExpiresByType application/javascript "now plus 1 week"
ExpiresByType application/x-javascript "now plus 1 week"

# Image files expiration: 1 month after request
ExpiresByType image/bmp "now plus 1 month"
ExpiresByType image/gif "now plus 1 month"
ExpiresByType image/jpeg "now plus 1 month"
ExpiresByType image/jp2 "now plus 1 month"
ExpiresByType image/pipeg "now plus 1 month"
ExpiresByType image/png "now plus 1 month"
ExpiresByType image/svg+xml "now plus 1 month"
ExpiresByType image/tiff "now plus 1 month"
ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
ExpiresByType image/x-icon "now plus 1 month"
ExpiresByType image/ico "now plus 1 month"
ExpiresByType image/icon "now plus 1 month"
ExpiresByType text/ico "now plus 1 month"
ExpiresByType application/ico "now plus 1 month"
ExpiresByType image/vnd.wap.wbmp "now plus 1 month"
ExpiresByType application/vnd.wap.wbxml "now plus 1 month"

ExpiresByType application/smil "now plus 1 month"
# Audio files expiration: 1 month after request
ExpiresByType audio/basic "now plus 1 month"
ExpiresByType audio/mid "now plus 1 month"
ExpiresByType audio/midi "now plus 1 month"
ExpiresByType audio/mpeg "now plus 1 month"
ExpiresByType audio/x-aiff "now plus 1 month"
ExpiresByType audio/x-mpegurl "now plus 1 month"
ExpiresByType audio/x-pn-realaudio "now plus 1 month"
ExpiresByType audio/x-wav "now plus 1 month"

# Movie files expiration: 1 month after request
ExpiresByType application/x-shockwave-flash "now plus 1 month"
ExpiresByType x-world/x-vrml "now plus 1 month"
ExpiresByType video/x-msvideo "now plus 1 month"
ExpiresByType video/mpeg "now plus 1 month"
ExpiresByType video/mp4 "now plus 1 month"
ExpiresByType video/quicktime "now plus 1 month"
ExpiresByType video/x-la-asf "now plus 1 month"
ExpiresByType video/x-ms-asf "now plus 1 month"

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirectsErrorDocument 404  error.php
#
# If you need to Redirect 301 some pages, or set a canonical non-www to
# www Redirect 301 (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects

##
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##

RewriteBase /

#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]



#
#  mod_rewrite in use

RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule index.php  /de/404? [R=301,L]

RewriteCond %{QUERY_STRING} ^Itemid=(.*)$
RewriteRule index.php  /de/404? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=$ 
RewriteRule ^index\.php$ /it/disturbi/cefalea-muscolo-tensiva? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=31&Itemid=39&lang=it$ 
RewriteRule ^index\.php$ /de/beschwerden/spannungskopfschmerzen? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=41&Itemid=49&lang=de$ 
RewriteRule ^index\.php$ /de/beschwerden/kopfschmerzen? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=31&Itemid=39$ 
RewriteRule ^index\.php$ /de/beschwerden/migräne? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=28&Itemid=36$
RewriteRule ^index\.php$ /de/beschwerden/skoliose? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=84&Itemid=81$
RewriteRule ^index\.php$ /de/beschwerden/bandscheibenvorfall? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=30&Itemid=37$
RewriteRule ^index\.php$ /de/beschwerden/schleudertrauma? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=82&Itemid=79&lang=de$
RewriteRule ^index\.php$ /de/beschwerden/hexenschuss? [R=301,L]

RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=82&Itemid=79$
RewriteRule ^index\.php$ /de/ischialgie? [R=301,L]


RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=109&Itemid=83&lang=it$
RewriteRule ^index\.php$ /it? [R=301,L]

当我使用此代码修改#HTTPS重定向时,我收到内部服务器错误:

RewriteCond %{HTTP_HOST} !^www\.atlantotec\.com$
RewriteRule ^(.*)$ https://www.atlantotec.com/$1 [L,R=301]

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteRule ^(.*)=it$ http://www.atlantotec.com/it/$1 [R,NC]
RewriteRule ^(.*)=de$ http://www.atlantotec.com/de/$1 [R,NC]
RewriteRule ^(.*)=en$ http://www.atlantotec.com/en/$1 [R,NC]

我的错误在哪里?我试过很多方面,但我只得到内部服务器错误。

0 个答案:

没有答案