我在我的cgi-bin文件夾和我的html文件夾中的其他文件中有一些文件。mod_rewrite沒有正確重定向Perl的CGI網址
當我訪問/cgi-bin/index.cgi時,顯示正常的索引頁面。但是,當我訪問我的域名時,如「domain.com」,它給了我一個apache頁面。有可能說,那裏沒有index.html頁面,並且在我的html文件夾中沒有index.html頁面。但是,我的html文件夾中的.htaccess文件假設正確重定向鏈接。但是,這些鏈接沒有被重定向。
下面是.htaccess文件我有
deny from 127.1.1.4
deny from 127.1.1.1
AddDefaultCharset utf-8
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_CGI_AUTHORIZATION:%1]
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([0-9A-Za-z]{12})(\/?.+|$)$ ?op=download1&id=$1&fname=$2 [L]
RewriteRule ^([0-9A-Za-z]{12})(\/.+|\.html?|$) ?op=download1&id=$1&fname=$2 [L]
RewriteRule ^embed-([0-9A-Za-z]{12})\.html$ ?op=video_embed&file_code=$1 [L]
RewriteRule ^embedmp3-([0-9A-Za-z]{12})\.html$ ?op=mp3_embed&file_code=$1 [L]
RewriteRule ^box$ /cgi-bin/index_box.cgi [L]
RewriteRule ^$ /cgi-bin/index.cgi [L]
RewriteRule ^free([0-9]+)\.html$ /cgi-bin/index.cgi?op=registration&aff_id=$1 [L]
RewriteRule ^checkfiles\.html$ /cgi-bin/index.cgi?op=checkfiles [L]
RewriteRule ^contact\.html$ /cgi-bin/index.cgi?op=contact [L]
RewriteRule ^premium\.html$ /cgi-bin/index.cgi?op=payments [L]
RewriteRule ^login\.html$ ?op=login [L]
RewriteRule ^catalogue(.*)\.html$ /cgi-bin/index.cgi?op=catalogue&date=$1 [L]
RewriteRule ^news([0-9]*)\.html$ ?op=news&page=$1 [L]
RewriteRule ^n([0-9]+)-.*\.html$ /cgi-bin/index.cgi?op=news_details&news_id=$1 [L]
RewriteRule ^faq\.html$ /cgi-bin/index.cgi?op=page&tmpl=faq [L]
RewriteRule ^tos\.html$ /cgi-bin/index.cgi?op=page&tmpl=tos [L]
RewriteRule ^links\.html$ /cgi-bin/index.cgi?op=links [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^pages/([a-z0-9\-\_]+).html /cgi-bin/index.cgi?op=page&tmpl=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^users/([0-9A-Za-z\-_]{4,64})/?([0-9]+|$) /cgi-bin/index.cgi?op=user_public&usr_login=$1&fld_id=$2 [L,NC]
RewriteRule \.pm$ /404.html [L]
ErrorDocument 404 /404.html
例如此鏈接:domain.com/?op=registration不重定向到正確的頁面。
同此鏈接:domain.com/login.html
和所有其他環節要誠實。我99%肯定這是因爲上面發佈的.htaccess文件,但我似乎無法找出索引重定向的問題。
爲幫助調試,你可以做的一件事是將所有這些重定向改爲'[L,R = 302]'。然後'捲曲'鏈接,看看你是否得到(通常由你的瀏覽器隱藏)重定向鏈接,包括。 '
該文件已移動here。
' –