2013-09-27 6 views
0

В принципе, без этого кода в моем файле .htaccess ни одна из моих внутренних ссылок на моем сайте не работает.Почему мои внутренние ссылки не работают

Но с этим в моем .htaccess файлах, я получаю тонну HTTP/1.1 500 ошибок и несколько ошибок 302.

Это код:

RewriteCond %{REQUEST_URI} !^/index\.php 
RewriteRule .* index.php [L] 

Я попытался изменить %{REQUEST_URI} к %{HTTP_HOST}. Это фиксировало проблему внутренней связи, но ошибки все еще существуют.

Как мне изменить это, чтобы удалить все ошибки, которые я получаю, и чтобы мои внутренние ссылки работали?

PS. Мой сайт построен в Joomla.


В случае необходимости, это мой полный .htaccess файл ":

Options +FollowSymLinks 
<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> 

RewriteEngine On 
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR] 
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR] 
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] 
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 
RewriteRule .* index.php [F] 

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

Options +FollowSymLinks 
RewriteCond %{THE_REQUEST} ^.*/index\.php 
RewriteCond %{HTTP_HOST} !^(m)\.candoboatloans\.com\.au/index.php 
RewriteRule ^(.*)index.php$ http://www.candoboatloans.com.au/$1 [R=301,L] 

RewriteRule ^(.*)\.htm$ $1.html [L] 

#RewriteBase/

RewriteCond %{HTTP_HOST} !^/index\.php 
RewriteRule .* index.php [L] 



# 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] 
+0

Это весь ваш файл .htaccess. – Prix

+0

Привет, @Prix. Нет, это не так. Хочешь, чтобы я опубликовал его? – Fizzix

+1

В противном случае мы не можем точно определить, в чем проблема, если возможно, также укажите, как выглядит ваша структура папок, например: '/ home/youraccount/public_html /' equals domain.com, а также где установлена ​​Joomla? – Prix

ответ

2

Дайте этому попытку, его основе, шаблонов по умолчанию .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 
+0

Фантастический. Работает довольно хорошо :) К сожалению, я все еще получаю несколько ошибок, и похоже, что это только от 'RewriteRule (. *) Index.php'. Я удаляю его, и ошибки уходят, а внутренние ссылки не работают. Когда я помещаю его обратно, внутренние ссылки работают, хотя я получаю некоторые ошибки. Является ли это вообще возможным? – Fizzix

+1

@fizzix Какие ошибки вы получаете точно? ** Если вы можете указать как можно более подробные ошибки, как в том, что вы пытаетесь сделать и что они должны делать, но не делают, я мог бы вам помочь. ** – Prix

+0

Если вы путешествуете на эту страницу: http: // www .ragepank.com/redirect-check/и введите в моем доменном имени 'candoboatloans.com.au', вы увидите три красные ошибки. Это те, которые я пытаюсь исправить. – Fizzix

Смежные вопросы