我正在通过 Windows 7 计算机在本地安装的 XAMPP 上运行 youtube 克隆脚本。安装后,我能够看到主页,但如果我通过链接或直接 URL 导航到任何其他页面,我都会收到“未找到对象”404 错误。我感觉这可能与我的 .htaccess 文件有关,但不是 100%。
我的网站是通过 dev.mywebsite.com 设置在虚拟主机上并指向我本地机器上的一个文件夹的。
下面我包含了当前.htaccess 文件的内容。
# deny directory listing, enable symbolic links
Options -Indexes +FollowSymlinks
AddType video/mp4 .mp4
AddType video/webm .webm
AddType video/ogg .ogv
AddType image/jpeg .jpeg
AddType image/jpeg .jpg
AddType image/png .png
AddType image/gif .gif
AddType audio/mpeg .mp3
AddType application/pdf .pdf
<Files *>
allow from 173.0.80.0/24 ##PayPal
allow from 173.0.81.0/24 ##PayPal
allow from 173.0.82.0/24 ##PayPal
allow from 173.0.83.0/24 ##PayPal
allow from all
</Files>
# protect .htaccess
<Files .htaccess>
deny from all
</Files>
# protect script files, template file, log files
<Files ~ "^(.*)\.(inc|inc\.php|s?p?html|cgi|pl|py|asp|aspx|sh|cin|tpl|tplb|log)$">
Order allow,deny
Deny from all
</Files>
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|woff|webp)$">
Header set Cache-Control "max-age=84600, public"
</FilesMatch>
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType text/html "access 1 week"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 week"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 month"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_headers.c>
Header set Connection keep-alive
<filesmatch "\.(ico|flv|gif|swf|eot|woff|otf|ttf|svg)$">
Header set Cache-Control "max-age=604800, public"
</filesmatch>
<filesmatch "\.(jpg|jpeg|png)$">
Header set Cache-Control "max-age=604800, public"
</filesmatch>
# css and js should use private for proxy caching https://developers.google.com/speed/docs/best-practices/caching#LeverageProxyCaching
<filesmatch "\.(css|js)$">
Header set Cache-Control "max-age=604800, private"
</filesmatch>
#<filesMatch "\.(x?html?|php)$">
# Header set Cache-Control "max-age=600, private, must-revalidate"
#</filesMatch>
</IfModule>
# begin rewrite rules
RewriteEngine On
# redirect to www
# RewriteCond %{HTTP_HOST} ^your-domain.com [NC]
# RewriteRule ^(.*)$ http://www.your-domain.com/$1 [L,R=301]
## uncomment for SEO urls
RewriteRule ^([viadb])/([^/]*)/([^/]*)&p=([^/]*)$ f_modules/m_frontend/m_file/view.php?$1=$2&p=$4&g=1 [L]
RewriteRule ^([viadb])/([^/]*)/([^/]*)$ f_modules/m_frontend/m_file/view.php?$1=$2&g=1 [L]
RewriteRule ^videos/([^/]*)$ f_modules/m_frontend/m_file/browse.php?t=video&c=$1 [L]
RewriteRule ^pictures/([^/]*)$ f_modules/m_frontend/m_file/browse.php?t=image&c=$1 [L]
RewriteRule ^music/([^/]*)$ f_modules/m_frontend/m_file/browse.php?t=audio&c=$1 [L]
RewriteRule ^documents/([^/]*)$ f_modules/m_frontend/m_file/browse.php?t=document&c=$1 [L]
RewriteRule ^blogs/([^/]*)$ f_modules/m_frontend/m_file/browse.php?t=blog&c=$1 [L]
RewriteRule ^channels/([^/]*)$ f_modules/m_frontend/m_acct/channels.php?t=channel&c=$1 [L]
# image hotlinking protection
# RewriteCond %{HTTP_REFERER} !^$
# RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
# RewriteRule \.(jpg|jpeg|png|gif|bmp)$ - [F]
# passing all requests through parser.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* parser.php [L,QSA]
# begin block
SetEnvIfNoCase User-Agent "Abonti|aggregator|AhrefsBot|asterias|BDCbot|BLEXBot|BuiltBotTough|Bullseye|BunnySlippers|ca\-crawler|CCBot|Cegbfeieh|CheeseBot|CherryPicker|CopyRightCheck|cosmos|Crescent|discobot|DittoSpyder|DotBot|Download Ninja|EasouSpider|EmailCollector|EmailSiphon|EmailWolf|EroCrawler|Exabot|ExtractorPro|Fasterfox|FeedBooster|Foobot|Genieo|grub\-client|Harvest|hloader|httplib|HTTrack|humanlinks|ieautodiscovery|InfoNaviRobot|IstellaBot|Java/1\.|JennyBot|k2spider|Kenjin Spider|Keyword Density/0\.9|larbin|LexiBot|libWeb|libwww|LinkextractorPro|linko|LinkScan/8\.1a Unix|LinkWalker|LNSpiderguy|lwp\-trivial|magpie|Mata Hari|MaxPointCrawler|MegaIndex|Microsoft URL Control|MIIxpc|Mippin|Missigua Locator|Mister PiX|MJ12bot|moget|MSIECrawler|NetAnts|NICErsPRO|Niki\-Bot|NPBot|Nutch|Offline Explorer|Openfind|panscient\.com|PHP/5\.\{|ProPowerBot/2\.14|ProWebWalker|Python\-urllib|QueryN Metasearch|RepoMonkey|SemrushBot|SISTRIX|sitecheck\.Internetseer\.com|SiteSnagger|SnapPreviewBot|Sogou|SpankBot|spanner|spbot|Spinn3r|suzuran|Szukacz/1\.4|Teleport|Telesoft|The Intraformant|TheNomad|TightTwatBot|Titan|toCrawl/UrlDispatcher|True_Robot|turingos|TurnitinBot|UbiCrawler|UnisterBot|URLy Warning|VCI|WBSearchBot|Web Downloader/6\.9|Web Image Collector|WebAuto|WebBandit|WebCopier|WebEnhancer|WebmasterWorldForumBot|WebReaper|WebSauger|Website Quester|Webster Pro|WebStripper|WebZip|Wotbox|wsr\-agent|WWW\-Collector\-E|Xenu|Zao|Zeus|ZyBORG|coccoc|Incutio|lmspider|memoryBot|SemrushBot|serf|Unknown|uptime files" bad_bot
SetEnvIfNoCase User-Agent "Aboundex|80legs|360Spider|^Java|^Cogentbot|^Alexibot|^asterias|^attach|^BackDoorBot|^BackWeb|Bandit|^BatchFTP|^Bigfoot|^Black.Hole|^BlackWidow|^BlowFish|^BotALot|Buddy|^BuiltBotTough|^Bullseye|^BunnySlippers|^Cegbfeieh|^CheeseBot|^CherryPicker|^ChinaClaw|Collector|Copier|^CopyRightCheck|^cosmos|^Crescent|^Custo|^AIBOT|^DISCo|^DIIbot|^DittoSpyder|^Download\ Demon|^Download\ Devil|^Download\ Wonder|^dragonfly|^Drip|^eCatch|^EasyDL|^ebingbong|^EirGrabber|^EmailCollector|^EmailSiphon|^EmailWolf|^EroCrawler|^Exabot|^Express\ WebPictures|Extractor|^EyeNetIE|^Foobot|^flunky|^FrontPage|^Go-Ahead-Got-It|^gotit|^GrabNet|^Grafula|^Harvest|^hloader|^HMView|^HTTrack|^humanlinks|^IlseBot|^Image\ Stripper|^Image\ Sucker|Indy\ Library|^InfoNaviRobot|^InfoTekies|^Intelliseek|^InterGET|^Internet\ Ninja|^Iria|^Jakarta|^JennyBot|^JetCar|^JOC|^JustView|^Jyxobot|^Kenjin.Spider|^Keyword.Density|^larbin|^LexiBot|^lftp|^libWeb/clsHTTP|^likse|^LinkextractorPro|^LinkScan/8.1a.Unix|^LNSpiderguy|^LinkWalker|^lwp-trivial|^LWP::Simple|^Magnet|^Mag-Net|^MarkWatch|^Mass\ Downloader|^Mata.Hari|^Memo|^Microsoft.URL|^Microsoft\ URL\ Control|^MIDown\ tool|^MIIxpc|^Mirror|^Missigua\ Locator|^Mister\ PiX|^moget|^Mozilla/3.Mozilla/2.01|^Mozilla.*NEWT|^NAMEPROTECT|^Navroad|^NearSite|^NetAnts|^Netcraft|^NetMechanic|^NetSpider|^Net\ Vampire|^NetZIP|^NextGenSearchBot|^NG|^NICErsPRO|^niki-bot|^NimbleCrawler|^Ninja|^NPbot|^Octopus|^Offline\ Explorer|^Offline\ Navigator|^Openfind|^OutfoxBot|^PageGrabber|^Papa\ Foto|^pavuk|^pcBrowser|^PHP\ version\ tracker|^Pockey|^ProPowerBot/2.14|^ProWebWalker|^psbot|^Pump|^QueryN.Metasearch|^RealDownload|Reaper|Recorder|^ReGet|^RepoMonkey|^RMA|Siphon|^SiteSnagger|^SlySearch|^SmartDownload|^Snake|^Snapbot|^Snoopy|^sogou|^SpaceBison|^SpankBot|^spanner|^Sqworm|Stripper|Sucker|^SuperBot|^SuperHTTP|^Surfbot|^suzuran|^Szukacz/1.4|^tAkeOut|^Teleport|^Telesoft|^TurnitinBot/1.5|^The.Intraformant|^TheNomad|^TightTwatBot|^Titan|^True_Robot|^turingos|^TurnitinBot|^URLy.Warning|^Vacuum|^VCI|^VoidEYE|^Web\ Image\ Collector|^Web\ Sucker|^WebAuto|^WebBandit|^Webclipping.com|^WebCopier|^WebEMailExtrac.*|^WebEnhancer|^WebFetch|^WebGo\ IS|^Web.Image.Collector|^WebLeacher|^WebmasterWorldForumBot|^WebReaper|^WebSauger|^Website\ eXtractor|^Website\ Quester|^Webster|^WebStripper|^WebWhacker|^WebZIP|Whacker|^Widow|^WISENutbot|^WWWOFFLE|^WWW-Collector-E|^Xaldon|^Xenu|^Zeus|ZmEu|^Zyborg|Acunetix|FHscan|Baiduspider|Yandex" bad_bot
Deny from env=bad_bot