Joomla 2.5 Как написать цикл для.htacces ?

Тема в разделе "Joomla и SEF (ЧПУ)", создана пользователем silatal, 12.05.2015.

  1. Offline

    silatal Недавно здесь

    Регистрация:
    01.12.2011
    Сообщения:
    7
    Симпатии:
    0
    Пол:
    Женский
    Здравствуйте.
    У меня ссылки плана mysite.ru/Catalog/ID
    а нужно: mysite.ru/Catalog/MyPage?id=ID из ссылки

    то есть mysite.ru/Catalog/150 -> mysite.ru/Catalog/MyPage?id=150
    Id от 00 до 500, Catalog и MyPage не изменяются

    Не писать же ручками, все 500 вариантов в .htacces. Помогите разобраться, как создать цикл?
     
    Последнее редактирование: 12.05.2015
  2.  
  3. Offline

    silatal Недавно здесь

    Регистрация:
    01.12.2011
    Сообщения:
    7
    Симпатии:
    0
    Пол:
    Женский
    нет, не работает :(
     
  4. OlegM
    Offline

    OlegM Russian Joomla! Team Команда форума

    Регистрация:
    12.04.2007
    Сообщения:
    4 311
    Симпатии:
    375
    Пол:
    Мужской
    Так конечно, я же на знаю реального URL и твоего реального .htaccess не видел.
    --- добавлено: 12.05.2015, первое сообщение размещено: 12.05.2015 ---
    Поправил - была лишняя квадратная скобка
     
  5. Offline

    silatal Недавно здесь

    Регистрация:
    01.12.2011
    Сообщения:
    7
    Симпатии:
    0
    Пол:
    Женский
    мой .htacces
    Код (CODE):
    1. ##
    2. # @package        Joomla
    3. # @copyright    Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
    4. # @license        GNU General Public License version 2 or later; see LICENSE.txt
    5. ##
    6.  
    7. ##
    8. # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
    9. #
    10. # The line just below this section: 'Options +FollowSymLinks' may cause problems
    11. # with some server configurations.  It is required for use of mod_rewrite, but may already
    12. # be set by your server administrator in a way that dissallows changing it in
    13. # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
    14. # beginning of line), reload your site in your browser and test your sef url's.  If they work,
    15. # it has been set by your server administrator and you do not need it set here.
    16. ##
    17.  
    18. ## Can be commented out if causes errors, see notes above.
    19. #Options +FollowSymLinks
    20.  
    21. ## Mod_rewrite in use.
    22.  
    23. RewriteEngine On
    24. Options +FollowSymLinks
    25.  
    26.  
    27.  
    28. #From subfolder to root. Start
    29. RewriteCond %{REQUEST_URI} ^/services
    30. RewriteRule ^services/(.*)$ /$1 [R=301,L]
    31. #From subfolder to root. End
    32.  
    33.  
    34. ## Begin - Rewrite rules to block out some common exploits.
    35. # If you experience problems on your site block out the operations listed below
    36. # This attempts to block the most common type of exploit `attempts` to Joomla!
    37. #
    38. # Block out any script trying to base64_encode data within the URL.
    39. RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
    40. # Block out any script that includes a <script> tag in URL.
    41. RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
    42. # Block out any script trying to set a PHP GLOBALS variable via URL.
    43. RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    44. # Block out any script trying to modify a _REQUEST variable via URL.
    45. RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    46. # Return 403 Forbidden header and show the content of the root homepage
    47. RewriteRule .* index.php [F]
    48. #
    49. ## End - Rewrite rules to block out some common exploits.
    50.  
    51. ## Begin - Custom redirects
    52. #
    53. # If you need to redirect some pages, or set a canonical non-www to
    54. # www redirect (or vice versa), place that code here. Ensure those
    55. # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
    56. #
    57. ## End - Custom redirects
    58.  
    59. ##
    60. # Uncomment following line if your webserver's URL
    61. # is not directly related to physical file paths.
    62. # Update Your Joomla! Directory (just / for root).
    63. ##
    64.  
    65. RewriteBase /
    66.  
    67. # RewriteCond %{REQUEST_FILENAME} !-d
    68. # RewriteCond %{REQUEST_URI} ^(.+)/$
    69. # RewriteRule ^(.+)/$ /$1 [R=301,L]
    70.  
    71.  
    72. #########################################################
    73. #     редирект с www на без и со слешом на без слеша    #
    74. #########################################################
    75. # www + /   =>  !www + !/
    76. # RewriteCond %{REQUEST_URI} ^!admin
    77. # RewriteCond %{REQUEST_FILENAME} !-f
    78. # RewriteCond %{HTTP_HOST} ^www\.(.+)
    79. # RewriteRule ^(.*)\/$ http://%1/$1 [L,R=301]
    80. # # # /            => !/
    81. # RewriteCond %{REQUEST_FILENAME} !-d
    82. # RewriteCond %{HTTP_HOST} ^([^www].*)$
    83. # RewriteRule ^(.*)\/$ http://%1/$1 [L,R=301]
    84. # # # www        => !www
    85. # # RewriteCond %{REQUEST_URI} ^!admin
    86. # RewriteCond %{REQUEST_FILENAME} !-d
    87. # RewriteCond %{HTTP_HOST} ^www\.(.+)
    88. # RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
    89. ##########################################################
    90.  
    91.  
    92. RewriteCond %{REQUEST_URI} ^\/$
    93. RewriteCond %{HTTP_HOST} ^www\.(.*)$
    94. RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
    95.  
    96. RewriteCond %{REQUEST_URI} !metas
    97. RewriteCond %{REQUEST_URI} !administrator
    98. RewriteCond %{REQUEST_URI} !\?
    99. RewriteCond %{REQUEST_URI} !\&
    100. RewriteCond %{REQUEST_URI} !\=
    101. RewriteCond %{REQUEST_URI} !\.
    102. RewriteCond %{REQUEST_URI} \/$
    103. RewriteCond %{HTTP_HOST} ^www\.(.*)$
    104. RewriteRule ^(.*)\/$ http://%1/$1 [L,R=301]
    105.  
    106. RewriteCond %{REQUEST_URI} !metas
    107. RewriteCond %{REQUEST_URI} !administrator
    108. RewriteCond %{REQUEST_URI} !\?
    109. RewriteCond %{REQUEST_URI} !\&
    110. RewriteCond %{REQUEST_URI} !\=
    111. RewriteCond %{REQUEST_URI} !\.
    112. RewriteCond %{REQUEST_URI} !\/$
    113. RewriteCond %{HTTP_HOST} ^www\.(.*)$
    114. RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
    115.  
    116. RewriteCond %{REQUEST_URI} !metas
    117. RewriteCond %{REQUEST_URI} !administrator
    118. RewriteCond %{REQUEST_URI} !\?
    119. RewriteCond %{REQUEST_URI} !\&
    120. RewriteCond %{REQUEST_URI} !\=
    121. RewriteCond %{REQUEST_URI} !\.
    122. RewriteCond %{REQUEST_URI} \/$
    123. RewriteCond %{HTTP_HOST} ^([^www].*)$
    124. RewriteRule ^(.*)\/$ http://%1/$1 [L,R=301]
    125.  
    126.  
    127. RewriteCond %{REQUEST_URI} ^/index.php(.+)$
    128. RewriteCond %{REQUEST_URI} !administrator
    129.  
    130. RewriteCond %{THE_REQUEST} ^.*index.php
    131. RewriteCond %{REQUEST_URI} !administrator
    132.  
    133.  
    134. ## Begin - Joomla! core SEF Section.
    135. #
    136. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    137. #
    138. # If the requested path and file is not /index.php and the request
    139. # has not already been internally rewritten to the index.php script
    140. RewriteCond %{REQUEST_URI} !^/index\.php
    141. # and the request is for something within the component folder,
    142. # or for the site root, or for an extensionless URL, or the
    143. # requested URL ends with one of the listed extensions
    144. RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
    145. # and the requested path and file doesn't directly match a physical file
    146. RewriteCond %{REQUEST_FILENAME} !-f
    147. # and the requested path and file doesn't directly match a physical folder
    148. RewriteCond %{REQUEST_FILENAME} !-d
    149. # internally rewrite the request to the index.php script
    150. RewriteRule .* index.php [L]
    151. #
    152. ## End - Joomla! core SEF Section.


    ссылка:
    mysite.ru/Catalog/ID
    а нужно: mysite.ru/Catalog/MyPage?id=ID из ссылки

    то есть mysite.ru/Catalog/150 -> mysite.ru/Catalog/MyPage?id=150
    Id от 00 до 500, Catalog и MyPage не изменяются
     
  6. OlegM
    Offline

    OlegM Russian Joomla! Team Команда форума

    Регистрация:
    12.04.2007
    Сообщения:
    4 311
    Симпатии:
    375
    Пол:
    Мужской
    Ну и зачем изначально людей путаешь, а потом правишь?
     
  7. Offline

    silatal Недавно здесь

    Регистрация:
    01.12.2011
    Сообщения:
    7
    Симпатии:
    0
    Пол:
    Женский
    Прошу прощения, просто оригинальный дубль содержит около 200 символов и очень сложно найти откуда что берется, как и почему это формируется.
    Написала в итоге 500 одинаковых страниц в .htacces вся проблема с дублями решилась, но блин... :(
     
  8. AKopytenko
    Offline

    AKopytenko Russian Joomla! Team Команда форума

    Регистрация:
    01.09.2011
    Сообщения:
    1 963
    Симпатии:
    168
    Пол:
    Мужской
    в htaccess можно вписать "цикл"? 0_0
     
  9. OlegM
    Offline

    OlegM Russian Joomla! Team Команда форума

    Регистрация:
    12.04.2007
    Сообщения:
    4 311
    Симпатии:
    375
    Пол:
    Мужской
    Забей!
    в htaccess можно вписать 500 строк редиректов!
     

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

Загрузка...