Проблема (может незнание) с 301-м редиректом

Тема в разделе "Ошибки при работе с Joomla", создана пользователем Dimoff-77, 19.12.2014.

  1. Offline

    Dimoff-77 Недавно здесь

    Регистрация:
    19.11.2014
    Сообщения:
    8
    Симпатии:
    0
    Пол:
    Мужской
    Добрый день всем!!!

    Пытаюсь на сайте в joomla 2.5 сделать редирект 301 со страницы А на страницу Б.
    И параллельно закрыть дубль главной страницы.

    Для этого в .htaccess в Mod_rewrite прописываю следующие строчки:

    Код (CODE):
    1. ------------------------------------------------------------------------------------------------------------------------------------------------------
    2. RewriteRule ^http://www.stroytp.ru/index.php/$ http://www.stroytp.ru/$ [R=301]
    3. RewriteRule ^http://www.stroytp.ru/oborudovanie/85-oborudovanie/oborudovanie-dlya-formovaniya/227-oborudovanie-proizvodstvo-pazogrebnevih-plit/$ http://www.stroytp.ru/pgp-proizvodstvo/$  [R=301, L]
    4. ------------------------------------------------------------------------------------------------------------------------------------------------------


    После чего сайт не грузится с ошибкой 500.

    Сразу отвечу на возможные вопросы:
    Мод включил - on.
    L - в скобках убрал.
    Сайт расположен не у нас а на платном хостинге.
     
    Последнее редактирование модератором: 19.12.2014
  2.  
  3. OlegK
    Offline

    OlegK Russian Joomla! Team Команда форума ⇒ Профи ⇐

    Регистрация:
    17.01.2011
    Сообщения:
    7 813
    Симпатии:
    771
    Пол:
    Мужской
    RewriteRule работает от корня сайта, типа так
    Код (PHP):
    1. RewriteRule /index.php/(.*)$ http://www.stroytp.ru/$1 [R=301]
     
  4. Offline

    Dimoff-77 Недавно здесь

    Регистрация:
    19.11.2014
    Сообщения:
    8
    Симпатии:
    0
    Пол:
    Мужской
    Спасибо за совет, но не помогаеть(((
     
  5. OlegK
    Offline

    OlegK Russian Joomla! Team Команда форума ⇒ Профи ⇐

    Регистрация:
    17.01.2011
    Сообщения:
    7 813
    Симпатии:
    771
    Пол:
    Мужской
    а если еще так ,экранируя точку в маске правила вхождения
    Код (PHP):
    1. RewriteRule /index\.php/(.*)$ http://www.stroytp.ru/$1 [R=301]
     
  6. Offline

    Dimoff-77 Недавно здесь

    Регистрация:
    19.11.2014
    Сообщения:
    8
    Симпатии:
    0
    Пол:
    Мужской

    К сожалению и это не помогает... Никак не могу сделать хоть какой-то редирект. Чувствую себя тупым и глупым.

    Может всеже с кодом страницы что не так? Вот первоначальная без редиректа (PS все предыдущие изменения вносил не я, и к сожалению я не спец по этому направленияю :-( )


    Код (PHP):
    1. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    2.  
    3. ##
    4. # @package        Joomla
    5. # @copyright    Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
    6. # @license        GNU General Public License version 2 or later; see LICENSE.txt
    7. ##
    8.  
    9. ##
    10. # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
    11. #
    12. # The line just below this section: 'Options +FollowSymLinks' may cause problems
    13. # with some server configurations.  It is required for use of mod_rewrite, but may already
    14. # be set by your server administrator in a way that dissallows changing it in
    15. # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
    16. # beginning of line), reload your site in your browser and test your sef url's.  If they work,
    17. # it has been set by your server administrator and you do not need it set here.
    18. ##
    19.  
    20. ## Can be commented out if causes errors, see notes above.
    21. Options +FollowSymLinks
    22.  
    23. ## Mod_rewrite in use.
    24.  
    25. RewriteEngine On
    26.  
    27. ## Begin - Rewrite rules to block out some common exploits.
    28. # If you experience problems on your site block out the operations listed below
    29. # This attempts to block the most common type of exploit `attempts` to Joomla!
    30. #
    31. # Block out any script trying to base64_encode data within the URL.
    32. RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
    33. # Block out any script that includes a <script> tag in URL.
    34. RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
    35. # Block out any script trying to set a PHP GLOBALS variable via URL.
    36. RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    37. # Block out any script trying to modify a _REQUEST variable via URL.
    38. RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    39. # Return 403 Forbidden header and show the content of the root homepage
    40. RewriteRule .* index.php [F]
    41. #
    42. ## End - Rewrite rules to block out some common exploits.
    43.  
    44. ## Begin - Custom redirects
    45. #
    46. # If you need to redirect some pages, or set a canonical non-www to
    47. # www redirect (or vice versa), place that code here. Ensure those
    48. # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
    49. #
    50. ## End - Custom redirects
    51.  
    52. ##
    53. # Uncomment following line if your webserver's URL
    54. # is not directly related to physical file paths.
    55. # Update Your Joomla! Directory (just / for root).
    56. ##
    57.  
    58. RewriteBase /
    59.  
    60. ## Begin - Joomla! core SEF Section.
    61. #
    62. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    63. #
    64. # If the requested path and file is not /index.php and the request
    65. # has not already been internally rewritten to the index.php script
    66. RewriteCond %{REQUEST_URI} !^/index\.php
    67. # and the request is for something within the component folder,
    68. # or for the site root, or for an extensionless URL, or the
    69. # requested URL ends with one of the listed extensions
    70. RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
    71. # and the requested path and file doesn't directly match a physical file
    72. RewriteCond %{REQUEST_FILENAME} !-f
    73. # and the requested path and file doesn't directly match a physical folder
    74. RewriteCond %{REQUEST_FILENAME} !-d
    75. # internally rewrite the request to the index.php script
    76. RewriteRule .* index.php [L]
    77. #
    78. ## End - Joomla! core SEF Section.
    79.  
    80. ## USER IP BANNING
    81. <Limit GET POST>
    82. order allow,deny
    83. deny from 80.94.227.230
    84. allow from all
    85. </Limit>
    86.  
    87. RewriteCond %{REMOTE_ADDR} (80.94.227.230|80.94.227.230)
    88. RewriteRule .* http://www.gogle.com/ [R=301,L]
     
    Последнее редактирование модератором: 29.12.2014
  7. OlegK
    Offline

    OlegK Russian Joomla! Team Команда форума ⇒ Профи ⇐

    Регистрация:
    17.01.2011
    Сообщения:
    7 813
    Симпатии:
    771
    Пол:
    Мужской
    код в редакторе форматируй bb-code . закоменти строчку
    Код (PHP):
    1. #RewriteBase /
    И тестируй простым редиректом, добавив после RewriteEngine On
    Код (PHP):
    1. RewriteEngine On
    2. Redirect /index.php/the-news http://joomla-support.ru

    Набери в браузере адрес твоего сайта,добавив /index.php/the-news
     
  8. Offline

    Dimoff-77 Недавно здесь

    Регистрация:
    19.11.2014
    Сообщения:
    8
    Симпатии:
    0
    Пол:
    Мужской

    Дело сдвинулось с точки))) Редирект прошел, но при закоменченной
    1. #RewriteBase /
    Грузится только первая страница сайта... А менюшка выдает 500 ошибку(((
     

Поделиться этой страницей

Загрузка...