Apache 为什么不';我的内部链接不起作用吗

Apache 为什么不';我的内部链接不起作用吗,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,基本上,如果我的.htaccess文件中没有此代码,我网站上的任何内部链接都无法正常工作 但是在我的.htaccess文件中,我收到了大量HTTP/1.1500错误和一些302错误 代码如下: RewriteCond %{REQUEST_URI} !^/index\.php RewriteRule .* index.php [L] 我尝试将%{REQUEST\u URI}更改为%{HTTP\u HOST}。这修复了内部链接问题,但错误仍然存在 我将如何修改它以删除我收到的所有错误,从而使我的内

基本上,如果我的
.htaccess
文件中没有此代码,我网站上的任何内部链接都无法正常工作

但是在我的
.htaccess
文件中,我收到了大量
HTTP/1.1500
错误和一些
302
错误

代码如下:

RewriteCond %{REQUEST_URI} !^/index\.php
RewriteRule .* index.php [L]
我尝试将
%{REQUEST\u URI}
更改为
%{HTTP\u HOST}
。这修复了内部链接问题,但错误仍然存在

我将如何修改它以删除我收到的所有错误,从而使我的内部链接正常工作

PS.我的网站内置于Joomla


如果需要,这是我的完整
.htaccess
文件:

Options+FollowSymLinks
过期于
ExpiresDefault“访问加30天”
标题未设置ETag
FileTag无
重新启动发动机
RewriteCond%{QUERY\u STRING}base64\u encode[^(]*\([^)]*\)[或]
重写cond%{QUERY_STRING}(|%3E)[NC,或]
重写条件%{QUERY\u STRING}全局(|\[|\%[0-9A-Z]{0,2})[或]
重写条件%{QUERY\u STRING}\u请求(|\[|\%[0-9A-Z]{0,2})
重写规则。*index.php[F]
重写cond%{HTTP\u HOST}!^(m)\.candoboatloans\.com\.au
重写COND%{HTTP_HOST}!^www.candoboatloans\.com\.au
重写规则(.*)http://www.candoboatloans.com.au/$1[R=301,L]
选项+FollowSymLinks
RewriteCond%{THE_REQUEST}^.*/index\.php
重写cond%{HTTP\u HOST}!^(m)\.candoboatloans\.com\.au/index.php
重写规则^(.*)index.php$http://www.candoboatloans.com.au/$1[R=301,L]
重写规则^(.*)\.htm$$1.html[L]
#重写基/
重写cond%{HTTP_HOST}!^/index\.php
重写规则。*index.php[L]
#检查是否设置了mobile=1,并将cookie“mobile”设置为1
RewriteCond%{QUERY_STRING}(^ |&)mobile=1(&|$)
重写规则^-[CO=mobile:1:%{HTTP_HOST}]
#检查是否设置了mobile=0,并将cookie“mobile”设置为0
RewriteCond%{QUERY_STRING}(^ |&)mobile=0(&|$)
重写规则^-[CO=mobile:0:%{HTTP_HOST}]
#无法在同一请求中设置和读取cookie,请检查
RewriteCond%{QUERY_STRING}(^ |&)mobile=0(&|$)
重写规则^-[S=1]
#检查这是否像一个移动设备
RewriteCond%{HTTP:x-wap-profile}!^$[或]
重写cond%{HTTP|u USER|u AGENT}“安卓|黑莓| iphone | ipod | iemobile | opera mobile | palmos | webos |谷歌机器人手机”[NC,或]
重写cond%{HTTP:Profile}^$
#检查我们是否已经在移动站点上
重写cond%{HTTP_HOST}!^m\。
#检查以确保我们之前没有设置cookie
RewriteCond%{HTTP:Cookie}!\mobile=0(;|$)
#现在重定向到移动站点
重写规则^http://m.candoboatloans.com.au%{REQUEST_URI}[R,L]

尝试一下,它基于joomla的默认
.htaccess
以及您的
.htaccess
中所需的部分:

<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
    <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresDefault "access plus 30 days"
    </IfModule>
    Header unset ETag
    FileETag None
</FilesMatch>

#####################################################
#  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 disallows 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.
#
#####################################################

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

#
#  mod_rewrite in use
RewriteEngine On

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

# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^|&)mobile=1(&|$)
RewriteRule ^ - [CO=mobile:1:%{HTTP_HOST}]

# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule ^ - [CO=mobile:0:%{HTTP_HOST}]

# cookie can't be set and read in the same request so check
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule ^ - [S=1]

# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC,OR]
RewriteCond %{HTTP:Profile}       !^$

# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST}          !^m\.
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie}        !\mobile=0(;|$)
# Now redirect to the mobile site
RewriteRule ^ http://m.candoboatloans.com.au%{REQUEST_URI} [R,L]

# Redirect to www if not www.domain or m.domain
RewriteCond %{HTTP_HOST} !^(m)\.candoboatloans\.com\.au
RewriteCond %{HTTP_HOST} !^www\.candoboatloans\.com\.au
RewriteRule (.*) http://www.candoboatloans.com.au/$1 [R=301,L] 

# If it ends with index.php and is not m.domain redirect to www.domain.com/content
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteCond %{HTTP_HOST} !^(m)\.candoboatloans\.com\.au$
RewriteRule ^(.*)index.php$ http://www.candoboatloans.com.au/$1 [R=301,L] 

# Redirect all variations of index and default to www.domain.com/
# exception of index.php which should not be redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(default|index)\.(s?html?|pl|aspx?|cfm)[\s]+ [NC]
RewriteRule ^ /? [R=301,L]

########## 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 set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%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})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

过期于
ExpiresDefault“访问加30天”
标题未设置ETag
FileTag无
#####################################################
#如果选择使用此文件,请完整阅读此文件
#
#此部分下方的行:“选项+FollowSymLinks”可能会导致问题
#对于某些服务器配置。使用mod_rewrite需要它,但可能已经存在
#由服务器管理员以不允许在中更改的方式进行设置
#您的.htaccess文件。如果使用该文件导致服务器出错,请将其注释掉(添加到
#行的开头),在浏览器中重新加载站点并测试sef url。如果它们有效,
#它已由服务器管理员设置,您不需要在此处设置。
#
#####################################################
##如果导致错误,可以注释掉,请参见上面的注释。
选项+FollowSymLinks
#
#mod_重写正在使用中
重新启动发动机
#如果您的Web服务器的URL
#与物理文件路径没有直接关系。
#更新Joomla!目录(仅适用于根目录)
重写基/
#检查是否设置了mobile=1,并将cookie“mobile”设置为1
RewriteCond%{QUERY_STRING}(^ |&)mobile=1(&|$)
重写规则^-[CO=mobile:1:%{HTTP_HOST}]
#检查是否设置了mobile=0,并将cookie“mobile”设置为0
RewriteCond%{QUERY_STRING}(^ |&)mobile=0(&|$)
重写规则^-[CO=mobile:0:%{HTTP_HOST}]
#无法在同一请求中设置和读取cookie,请检查
RewriteCond%{QUERY_STRING}(^ |&)mobile=0(&|$)
重写规则^-[S=1]
#检查这是否像一个移动设备
RewriteCond%{HTTP:x-wap-profile}!^$[或]
重写cond%{HTTP|u USER|u AGENT}“安卓|黑莓| iphone | ipod | iemobile | opera mobile | palmos | webos |谷歌机器人手机”[NC,或]
重写cond%{HTTP:Profile}^$
#检查我们是否已经在移动站点上
重写cond%{HTTP_HOST}!^m\。
#检查以确保我们之前没有设置cookie
RewriteCond%{HTTP:Cookie}!\mobile=0(;|$)
#现在重定向到移动站点
重写规则^http://m.candoboatloans.com.au%{REQUEST_URI}[R,L]
#如果不是www.domain或m.domain,则重定向到www
重写cond%{HTTP\u HOST}!^(m)\.candoboatloans\.com\.au
重写COND%{HTTP_HOST}!^www.candoboatloans\.com\.au
重写规则(.*)http://www.candoboatloans.com.au/$1[R=301,L]
#如果它以index.php结尾,而不是m.domain,请重定向到www.domain.com/content
RewriteCond%{THE_REQUEST}^.*/index\.php
重写cond%{HTTP\u HOST}!^(m)\.candoboatloans\.com\.au$
重写规则^(.*)index.php$http://www.candoboatloans.com.au/$1[R=301,L]
#将索引和默认值的所有变体重定向到www.domain.com/
#index.php异常,不应重定向
重写cond%{THE|u REQUEST}^[A-Z]{3,}\s/+(默认|索引)\(s?html?| pl | aspx?| cfm)[\s]+[NC]
重写规则^/?[R=301,L]
##########开始-重写规则以阻止一些常见的漏洞攻击
##如果您的网站出现问题,请排除下面列出的操作
##这将试图阻止对Joomla的最常见类型的利用“尝试”!
#
#阻止任何试图通过URL设置mosConfig值的脚本
重写cond%{QUERY\u STRING}mosConfig\[a-zA-Z\]{1,21}(\\%3D)[或]
#阻止任何试图通过URL发送base64_编码垃圾的脚本
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
    <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresDefault "access plus 30 days"
    </IfModule>
    Header unset ETag
    FileETag None
</FilesMatch>

#####################################################
#  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 disallows 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.
#
#####################################################

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

#
#  mod_rewrite in use
RewriteEngine On

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

# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^|&)mobile=1(&|$)
RewriteRule ^ - [CO=mobile:1:%{HTTP_HOST}]

# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule ^ - [CO=mobile:0:%{HTTP_HOST}]

# cookie can't be set and read in the same request so check
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule ^ - [S=1]

# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC,OR]
RewriteCond %{HTTP:Profile}       !^$

# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST}          !^m\.
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie}        !\mobile=0(;|$)
# Now redirect to the mobile site
RewriteRule ^ http://m.candoboatloans.com.au%{REQUEST_URI} [R,L]

# Redirect to www if not www.domain or m.domain
RewriteCond %{HTTP_HOST} !^(m)\.candoboatloans\.com\.au
RewriteCond %{HTTP_HOST} !^www\.candoboatloans\.com\.au
RewriteRule (.*) http://www.candoboatloans.com.au/$1 [R=301,L] 

# If it ends with index.php and is not m.domain redirect to www.domain.com/content
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteCond %{HTTP_HOST} !^(m)\.candoboatloans\.com\.au$
RewriteRule ^(.*)index.php$ http://www.candoboatloans.com.au/$1 [R=301,L] 

# Redirect all variations of index and default to www.domain.com/
# exception of index.php which should not be redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(default|index)\.(s?html?|pl|aspx?|cfm)[\s]+ [NC]
RewriteRule ^ /? [R=301,L]

########## 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 set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%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})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section