2013-01-07 77 views
0

這個區域不是我最強的區域。但感覺我有一個大概的瞭解。.htaccess問題頁面,像文件夾訪問圖像

好的,所以我的問題是這樣的。我有一個公司爲我出於某種原因,這些都可以訪問工作:

http://www.pets4you.com/cats/(錯了,應該不能夠也沒有文件夾叫貓) http://www.pets4you.com/cats.html(正確的網址)

獲取更好: pets4you .COM /圖片/分類/ ad_8e286189f9c4e622ea12ebdcdd10b646(咦?) pets4you.com/images/classifieds/ad_8e286189f9c4e622ea12ebdcdd10b646.jpg

(無法建立網址,2鏈接這裏限制我猜)

我的主人ing公司告訴我這是:

RewriteEngine on 
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) 
RewriteRule .* - [F] 

我告訴他們他們錯了。這是一個跟蹤和評論,沒有改變。

任何方式,我的代碼(是的,東西很多,告訴我的老闆!):

Options +FollowSymLinks 
Options -Indexes 

RewriteEngine on 
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) 
RewriteRule .* - [F] 

<IfModule mod_rewrite.c> 
    RewriteCond %{HTTPS} !=on 
    RewriteCond %{HTTP_HOST} !^www\..+$ [NC] 
    RewriteRule^http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

    RewriteCond %{REQUEST_URI} /+[^\.]+$ 
    RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] 
</IfModule> 

RewriteRule ^(.*\.(css|js))$ min/index.php?f=$1&debug=0 [L] 
RewriteRule ^(.*)index.php$ http://www.pets4you.com/$1 [R=301,L] 

# BEGIN COMPRESSION AND CACHING 
<IfModule mod_deflate.c> 
    # Enable compression 
    # AddOutputFilterByType DEFLATE text/css text/javascript application/x-javascript text/html text/plain text/xml image/x-icon 
    AddOutputFilterByType DEFLATE text/plain 
    AddOutputFilterByType DEFLATE text/html 
    AddOutputFilterByType DEFLATE text/xml 
    AddOutputFilterByType DEFLATE text/css 
    AddOutputFilterByType DEFLATE application/xml 
    AddOutputFilterByType DEFLATE application/xhtml+xml 
    AddOutputFilterByType DEFLATE application/rss+xml 
    AddOutputFilterByType DEFLATE application/javascript 
    AddOutputFilterByType DEFLATE application/x-javascript 

    <IfModule mod_setenvif.c> 
     BrowserMatch ^Mozilla/4 gzip-only-text/html 
     BrowserMatch ^Mozilla/4\.0[678] no-gzip 
     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
     BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html 
    </IfModule> 
    <IfModule mod_headers.c> 
     # Make sure proxies deliver correct content 
     Header append Vary User-Agent env=!dont-vary 
     # Ensure proxies deliver compressed content correctly 
     Header append Vary Accept-Encoding 
    </IfModule> 
</IfModule> 
<IfModule mod_headers.c> 
    # No ETags, No Pragma 
    Header unset Pragma 
    Header unset ETag 
    # Default cache time to 1 year (31536000 sec) 
    Header set Cache-Control "max-age=31536000, public, must-revalidate" 
</IfModule> 

# No ETags 
FileETag none 
# CACHE SETTINGS (mod_expires) 

<IfModule mod_expires.c> 
    # Turn on Expires 
    # set default to "access plus 1 year" 
    ExpiresDefault A31536000 
    ExpiresActive On 
    # html - "modification plus 1 hour" 
    ExpiresByType text/html M3600 
    # css and JavaScript - "modification plus 6 weeks" 
    ExpiresByType text/css M3628800 
    ExpiresByType text/javascript M3628800 
    ExpiresByType application/x-javascript M3628800 
</IfModule> 

# No cache for php-files 
<FilesMatch "\.(php)$"> 
    <IfModule mod_expires.c> 
     ExpiresActive Off 
    </IfModule> 
    <IfModule mod_headers.c> 
     Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" 
    </IfModule> 
</FilesMatch> 
<IfModule mod_php5.c> 
    #php_value output_handler ob_gzhandler 
    php_flag display_errors Off 
    php_flag log_errors On 
    php_value upload_max_filesize 500M 
    php_value post_max_size 500M 
    php_value memory_limit 1000M 
    php_flag zlib.output_compression on 
    php_value zlib.output_compression_level 2 
    php_flag magic_quotes_gpc Off 
    php_flag magic_quotes_runtime Off 
    php_flag zend.ze1_compatibility_mode Off 
    php_value mbstring.func_overload 0 
    php_flag suhosin.session.encrypt Off 
    php_value session.auto_start 0 
    php_value session.gc_maxlifetime 54000 
    php_value session.gc_divisor 500 
    php_value session.gc_probability 1 
    php_value mysql.connect_timeout 1000 
    php_value mysql.allow_persistent Off 
</IfModule> 
############## 
# ERROR PAGES# 
############## 
ErrorDocument 401 /errors.php?code=401 
ErrorDocument 500 /errors.php?code=500 
ErrorDocument 403 /errors.php?code=403 
ErrorDocument 400 /errors.php?code=400 
ErrorDocument 404 /errors.php?code=404 
###################### 
# BREED DESCRIPTIONS # 
###################### 
RewriteRule ^dog_breed_description/teapoodle/?$ http://www.pets4you.com/dog_breed_description/poodle/ [R=301,L] 
RewriteRule ^dog_breed_description/toypoodle/?$ http://www.pets4you.com/dog_breed_description/poodle/ [R=301,L] 

RewriteRule ^dog_breed_description/([^/]+) descriptions.php?page=$1 [NC] 
RewriteRule ^cat_breed_description/([^/]+) descriptions.php?page=$1 [NC] 
############ 
# CALENDAR # 
############ 
#RewriteRule ^submitevent.html calendar.php?action=submitEvent [NC] 
#RewriteRule ^calendar/([^/]+)/([^/]+)/([^/]+)/([^/]+) errors.php?code=404 [NC] 
#RewriteRule ^calendar/([^/]+)/([^/]+)/([^/]+) errors.php?code=404 [NC] 
#RewriteRule ^calendar/([^/]+)/([^/]+) calendar.php?year=$1&month=$2 [NC] 
#RewriteRule ^calendar/([^/]+) calendar.php?year=$1 [NC] 
#RewriteRule ^calendar/ calendar.php [NC] 
################# 
# PET DIRECTORY # 
################# 
RewriteRule ^petsupplies/dogs/(.*).html/?$ directory.php?type=dog&page=$1 [QSA,L] 
RewriteRule ^petsupplies/cats/(.*).html/?$ directory.php?type=cat&page=$1 [QSA,L] 
RewriteRule ^petsupplies/(.*).html/?$ directory.php?page=$1 [QSA,L] 
RewriteRule ^petsupplies/search.php?$ directory.php?page=search [QSA,L] 
RewriteRule ^petsupplies/?$ http://www.pets4you.com/petsupplies.html [R=301,L] 
############### 
# PET GALLERY # 
############### 
RewriteRule ^gallery/([^/]+) gallery.php?breed=$1 [QSA,L] 
RewriteRule ^gallery/?$ gallery.php [QSA,L] 
RewriteRule ^gallery/index.html?$ gallery.php [R=301,L] 
############ 
# ARTICLES # 
############ 
RewriteRule ^petarticles/([^/]+) articles.php?action=a&id=$1 [NC] 
RewriteRule ^petarticles/?$ http://www.pets4you.com/petarticles.html [R=301,L] 
RewriteRule ^petarticles?$ http://www.pets4you.com/petarticles.html [R=301,L] 
RewriteRule ^petarticles.html/?$ articles.php [L] 
RewriteRule ^articles_search.php/?$ articles.php [QSA,L] 
################ 
# LOST & FOUND # 
################ 
RewriteRule ^lost_found.html/?$ lost_found.php [QSA,NC,L] 
######## 
# DOGS # 
######## 
RewriteRule ^studservice.html?$ http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^puppiesforsale/([^/]+) http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^dogs/([^/]+) http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^dogs/ http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^dogs.html?$ dogs.php?start=0 [QSA,L] 
RewriteRule ^dogs1/?$ dogs.php?start=1 [QSA,L] 
RewriteRule ^dogs2/?$ dogs.php?start=2 [QSA,L] 

RewriteRule ^cats/ http://www.pets4you.com/cats.html [R=301,L] 
RewriteRule ^cats.html/?$ cats.php [L] 

RewriteRule ^puppiesforsale.html?$ http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^teapoodle.html?$ http://www.pets4you.com/poodle.html [R=301,L] 
RewriteRule ^toypoodle.html?$ http://www.pets4you.com/poodle.html [R=301,L] 
############# 
# BREEDERS # 
############ 
#RewriteRule ^dogbreeders/([^/]+) dog_breeders.php?breed=$1 [NC] 
#RewriteRule ^dogbreeders/?$ http://www.pets4you.com/dog_breeders.html [R=301,L] 
#RewriteRule ^dogbreeders.html/?$ dog_breeders.php [L] 

#RewriteRule ^catbreeders/([^/]+) cat_breeders.php?breed=$1 [NC] 
#RewriteRule ^catbreeders/?$ http://www.pets4you.com/cat_breeders.html [R=301,L] 
#RewriteRule ^catbreeders.html/?$ cat_breeders.php [L] 
################ 
# STATE PET ADS # 
################ 
RewriteRule ^localpetads/(.*).html?start=([0-9])/?$ http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^localpetads/(.*).html/?$ http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^localpetads.html?$ http://www.pets4you.com/localpetads/ [R=301,L] 
RewriteRule ^localpetads/([^/]+)/([^/]+) http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^localpetads/([^/]+) http://www.pets4you.com/dogs.html [R=301,L] 
RewriteRule ^localpetads/ http://www.pets4you.com/dogs.html [R=301,L] 
########### 
# GENERAL # 
########### 
RewriteRule ^sitemap.html?$ sitemap.php?start=1 [QSA,L] 
RewriteRule ^sitemap2/?$ sitemap.php?start=2 [QSA,L] 
RewriteRule ^sitemap3/?$ sitemap.php?start=3 [QSA,L] 
RewriteRule ^sitemap4/?$ sitemap.php?start=4 [QSA,L] 

RewriteRule ^terms.html/?$ terms.html [L] 
RewriteRule ^google97ce2a2538777af1.html/?$ google97ce2a2538777af1.htm [L] 
RewriteRule ^googlef7b2dff2a5d7b41b.html/?$ googlef7b2dff2a5d7b41b.htm [L] 
RewriteRule ^dogvideos/ videos.php [NC] 
RewriteRule ^topdogs/ breedratings.php [NC] 
RewriteRule ^(.*).html/?$ pets4you.php?page=$1 [QSA,L] 

此外,有時當我輸入「www.pets4you.com」它引導到https( ?) 別的東西讓我無能爲力。

不是我最強的區域,.htaccess。任何錯誤都會讓我知道。所有重定向工作正常。讓我想起其他事情是由什麼引起的。

謝謝!

+0

並指出,即使總是有一些差異。當我在本地機器上運行這個相同的文件時,以上都不會發生。只有在託管服務器上運行時纔有效。 –

+0

你是否繼承了那個爛攤子,或者你在幹什麼? – aefxx

回答

0

哦,我的,真是一團糟,肖恩。如果沒有正確地瞭解服務器的內部信息(主要配置文件(httpd-xxx.conf)),那麼就無法完整地告訴發生了什麼事情。

我發現是什麼:

  1. 貓URL問題。該負責指令是:

    RewriteRule ^cats/ http://www.pets4you.com/cats.html [R=301,L] 
    RewriteRule ^cats.html/?$ cats.php [L] 
    
  2. 至於圖像被送達,並沒有適當的文件擴展名:這聽起來像mod_spelling裝入阿帕奇(你將不得不請與您的託管服務提供商)。

+0

非常感謝你的一些東西。 –

+0

也忘了我仍然有.htaccess中的貓和狗條件。但我也知道他們不會觸發,直到我實際上製作一個貓狗文件夾。看到我在htaccess中的代碼,但沒有創建文件夾,爲什麼它不重定向。但是,當我做一個文件夾,他們工作。任何方式......我現在至少有一些工作。再次,謝謝 –

+0

作爲一般規則:請upvote和/或接受對您有幫助的答案。哦,順便說一句。別客氣。 – aefxx

0

好的,所以我唯一能解決這個問題的方法就是這樣做。

我沒有使用cats.php,而是將文件重命名爲catspage.php。出於某種原因,使用與請求相同的名稱會導致奇怪的事情發生。 cats.html指向cats.php,但cats /能夠被拉起並調用cats.php。現在記住,我必須先與另一位客戶處理此事。

重命名文件後,這些URL停止工作,我想要的。但形象的東西就是我們的服務器。我們的每一個網站都與他們合作。

再次感謝所有。