Показано с 1 по 7 из 7

Тема: mod_rewrite и phtml

  1. #1
    Junior Member
    Регистрация
    26.07.2011
    Сообщений
    6

    По умолчанию mod_rewrite и phtml

    Как включить для определеного сайта mod_rewrite и phtml ?

  2. #2
    Senior Member
    Регистрация
    16.10.2010
    Сообщений
    1,656

    По умолчанию

    легко.. смотрите в строну Addtype
    AddType application/x-httpd-php .php .phtml

    в .htaccess

  3. #3
    Junior Member
    Регистрация
    26.07.2011
    Сообщений
    6

    По умолчанию

    Цитата Сообщение от HappyAlex Посмотреть сообщение
    легко.. смотрите в строну Addtype
    AddType application/x-httpd-php .php .phtml

    в .htaccess
    Вот мой конфиг

    [root@cp srv]# cat .htaccess
    DirectoryIndex index.html index.phtml index.php
    #deny from all
    allow from 192.168.1.20

    AddType application/x-httpd-php .php .phtml

    php_flag display_errors on
    php_flag log_errors on
    php_flag allow_call_time_pass_reference on

    php_value error_reporting 6135
    php_value error_log ".System/.ErrorLogs/php_error.log"

    php_flag register_globals off

    php_flag magic_quotes_gpc off
    php_flag magic_quotes_runtime off
    php_flag magic_quotes_sybase off


    RewriteEngine on
    RewriteBase /

    RewriteCond %{HTTP_USER_AGENT} ^.*rtm_spider.*$
    RewriteRule ^.*webim.* null [L]
    RewriteCond %{HTTP_USER_AGENT} ^.*rtm_spider.*$
    RewriteRule ^.*ajax.* null [L]

    RewriteRule ^(.*)index\.html?$ $1
    RewriteRule ^(.*)index\.html?.?(.+)$ 1?$2

    # ���������� �������
    RewriteRule ^shop/Product_([0-9]+)/? shop/?ProductID=$1 [L]
    RewriteRule ^shop/Pv_([0-9]+)/? shop/?PvID=$1 [L]

    # 'Cat' =>"CatID", (?:Cat_(\d+))?
    # 'Brand' =>"Brand", (?:/Brand_(\d+))?
    # 'OnlyNew' =>"OnlyNew", (?:/OnlyNew_(1))?
    # 'All' =>"NotOnlyInSight", (?:/All_(1))?
    # 'ot' =>"PriceMin", (?:/ot_(\d+))?
    # 'do' =>"PriceMax", (?:/do_(\d+))?
    # 'Rsort' =>"Sort", (?:/Rsort_(1))?
    # 'Page' =>"Page", (?:/Page_(\d+))?
    #

    RewriteRule ^shop/age_(\d+)/?(.?:index\.html?).? shop/?SetGlobalFilterAge=$1 [L]
    RewriteRule ^shop/Page_(\d+)(.?:/ot_(\d+)).?(.?:/do_(\d+)).?/?(.?:index\.html?).? shop/?Page=$1&PriceMin=$2&PriceMax=$3 [L]
    RewriteRule ^shop/Rsort_(1)(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?Sort=$1&PriceMin=$2&PriceMax=$3&Page=$4 [L]
    RewriteRule ^shop/do_(\d+)(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?PriceMax=$1&Sort=$2&Page=$3 [L]
    RewriteRule ^shop/ot_(\d+)(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?PriceMin=$1&PriceMax=$2&Sort=$3&Page=$4 [L]
    RewriteRule ^shop/All_(1)(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?NotOnlyInSight=$1&PriceMin=$2&PriceMax=$3&Sort=$4 &Page=$5 [L]
    RewriteRule ^shop/OnlyNew_(1)(.?:/All_(1)).?(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?)? shop/?OnlyNew=$1&NotOnlyInSight=$2&PriceMin=$3&PriceMax =$4&Sort=$5&Page=$6 [L]
    RewriteRule ^shop/Brand_(\d+)(.?:/OnlyNew_(1)).?(.?:/All_(1)).?(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?Brand=$1&OnlyNew=$2&NotOnlyInSight=$3&PriceMin=$4 &PriceMax=$5&Sort=$6&Page=$7 [L]
    RewriteRule ^shop/Cat_(\d+)(.?:/Brand_(\d+)).?(.?:/OnlyNew_(1)).?(.?:/All_(1)).?(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/.?(.?:index\.html?).? shop/?CatID=$1&Brand=$2&OnlyNew=$3&NotOnlyInSight=$4&Pr iceMin=$5&PriceMax=$6&Sort=$7&Page=$8 [L]

    RewriteRule ^news/id_(\d+)/?(.?:index\.html?).? news/?ID=$1 [L]

    RewriteRule ^articles/id_(\d+)/?(.?:index\.html?).? articles/?ID=$1 [L]
    RewriteRule ^articles/age_(\d+)/?(.?:index\.html?).? articles/?SetGlobalFilterAge=$1 [L]


    RewriteRule ^(404)/ - [L]
    RewriteRule ^_ - [L]
    RewriteRule \.(gif|jpg|png|js|css|exe|zip|rar|pdf|rtf|doc|xls| ppt|swf|ipx|txt|xslt|xsl|tif|eps|tiff|ico|ent|chm| cfm|gz|htm)$ - [L]

    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_FILENAME}/index.phtml -f
    RewriteRule ^(.*)$ - [L,QSA]

    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^(.*)$ - [L,QSA]

    # �᫨ ���� ����뢠�饣� ᫥�� � ��� �� 䠩� (⨯�, ���� ��窨), �� ������塞 ����.
    RewriteCond %{REQUEST_URI} !\.
    RewriteRule ^(.+[^/])$ http://%{SERVER_NAME}%{REQUEST_URI}/ [L,R,QSA]

    RewriteRule ^admin/(.*)$ _admin/$1 [L,R,QSA]

    RewriteCond %{REQUEST_URI} !\.
    RewriteRule ^(.*)$ _default.phtml?request=$1&uri=%{REQUEST_URI} [L,QSA]

    только сайт не работает

    Forbidden

    You don't have permission to access / on this server.
    Apache/2.2.3 (CentOS) Server at cp.domen.com Port 80

  4. #4
    Junior Member
    Регистрация
    26.07.2011
    Сообщений
    6

    По умолчанию

    Цитата Сообщение от HappyAlex Посмотреть сообщение
    легко.. смотрите в строну Addtype
    AddType application/x-httpd-php .php .phtml

    в .htaccess
    Вот мой конфиг

    DirectoryIndex index.html index.phtml index.php
    #deny from all
    allow from 192.168.1.20

    AddType application/x-httpd-php .php .phtml

    php_flag display_errors on
    php_flag log_errors on
    php_flag allow_call_time_pass_reference on

    php_value error_reporting 6135
    php_value error_log ".System/.ErrorLogs/php_error.log"

    php_flag register_globals off

    php_flag magic_quotes_gpc off
    php_flag magic_quotes_runtime off
    php_flag magic_quotes_sybase off


    RewriteEngine on
    RewriteBase /

    RewriteCond %{HTTP_USER_AGENT} ^.*rtm_spider.*$
    RewriteRule ^.*webim.* null [L]
    RewriteCond %{HTTP_USER_AGENT} ^.*rtm_spider.*$
    RewriteRule ^.*ajax.* null [L]

    RewriteRule ^(.*)index\.html?$ $1
    RewriteRule ^(.*)index\.html?.?(.+)$ 1?$2

    # ���������� �������
    RewriteRule ^shop/Product_([0-9]+)/? shop/?ProductID=$1 [L]
    RewriteRule ^shop/Pv_([0-9]+)/? shop/?PvID=$1 [L]

    # 'Cat' =>"CatID", (?:Cat_(\d+))?
    # 'Brand' =>"Brand", (?:/Brand_(\d+))?
    # 'OnlyNew' =>"OnlyNew", (?:/OnlyNew_(1))?
    # 'All' =>"NotOnlyInSight", (?:/All_(1))?
    # 'ot' =>"PriceMin", (?:/ot_(\d+))?
    # 'do' =>"PriceMax", (?:/do_(\d+))?
    # 'Rsort' =>"Sort", (?:/Rsort_(1))?
    # 'Page' =>"Page", (?:/Page_(\d+))?
    #

    RewriteRule ^shop/age_(\d+)/?(.?:index\.html?).? shop/?SetGlobalFilterAge=$1 [L]
    RewriteRule ^shop/Page_(\d+)(.?:/ot_(\d+)).?(.?:/do_(\d+)).?/?(.?:index\.html?).? shop/?Page=$1&PriceMin=$2&PriceMax=$3 [L]
    RewriteRule ^shop/Rsort_(1)(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?Sort=$1&PriceMin=$2&PriceMax=$3&Page=$4 [L]
    RewriteRule ^shop/do_(\d+)(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?PriceMax=$1&Sort=$2&Page=$3 [L]
    RewriteRule ^shop/ot_(\d+)(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?PriceMin=$1&PriceMax=$2&Sort=$3&Page=$4 [L]
    RewriteRule ^shop/All_(1)(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?NotOnlyInSight=$1&PriceMin=$2&PriceMax=$3&Sort=$4 &Page=$5 [L]
    RewriteRule ^shop/OnlyNew_(1)(.?:/All_(1)).?(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?)? shop/?OnlyNew=$1&NotOnlyInSight=$2&PriceMin=$3&PriceMax =$4&Sort=$5&Page=$6 [L]
    RewriteRule ^shop/Brand_(\d+)(.?:/OnlyNew_(1)).?(.?:/All_(1)).?(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/?(.?:index\.html?).? shop/?Brand=$1&OnlyNew=$2&NotOnlyInSight=$3&PriceMin=$4 &PriceMax=$5&Sort=$6&Page=$7 [L]
    RewriteRule ^shop/Cat_(\d+)(.?:/Brand_(\d+)).?(.?:/OnlyNew_(1)).?(.?:/All_(1)).?(.?:/ot_(\d+)).?(.?:/do_(\d+)).?(.?:/Rsort_(1)).?(.?:/Page_(\d+)).?/.?(.?:index\.html?).? shop/?CatID=$1&Brand=$2&OnlyNew=$3&NotOnlyInSight=$4&Pr iceMin=$5&PriceMax=$6&Sort=$7&Page=$8 [L]

    RewriteRule ^news/id_(\d+)/?(.?:index\.html?).? news/?ID=$1 [L]

    RewriteRule ^articles/id_(\d+)/?(.?:index\.html?).? articles/?ID=$1 [L]
    RewriteRule ^articles/age_(\d+)/?(.?:index\.html?).? articles/?SetGlobalFilterAge=$1 [L]


    RewriteRule ^(404)/ - [L]
    RewriteRule ^_ - [L]
    RewriteRule \.(gif|jpg|png|js|css|exe|zip|rar|pdf|rtf|doc|xls| ppt|swf|ipx|txt|xslt|xsl|tif|eps|tiff|ico|ent|chm| cfm|gz|htm)$ - [L]

    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_FILENAME}/index.phtml -f
    RewriteRule ^(.*)$ - [L,QSA]

    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^(.*)$ - [L,QSA]

    # �᫨ ���� ����뢠�饣� ᫥�� � ��� �� 䠩� (⨯�, ���� ��窨), �� ������塞 ����.
    RewriteCond %{REQUEST_URI} !\.
    RewriteRule ^(.+[^/])$ http://%{SERVER_NAME}%{REQUEST_URI}/ [L,R,QSA]

    RewriteRule ^admin/(.*)$ _admin/$1 [L,R,QSA]

    RewriteCond %{REQUEST_URI} !\.
    RewriteRule ^(.*)$ _default.phtml?request=$1&uri=%{REQUEST_URI} [L,QSA]


    Forbidden

    You don't have permission to access / on this server.
    Apache/2.2.3 (CentOS) Server at cp.akadeti.com Port 80

  5. #5
    Senior Member Аватар для xaker1
    Регистрация
    30.06.2009
    Сообщений
    2,739

    По умолчанию

    И что вы хотели этим показать? Рубитесь на 2-м правиле
    Стоит один раз попробовать что бы влюбиться... в ISP.

    На все мои сообщения, действует конфигурация сервера: ISP Pro (всегда актуальная current версия), FreeBSD 8.0, php as fcgi, nginx+apache.

    Бесплатные плагины для ISPmanager.

  6. #6
    Junior Member
    Регистрация
    26.07.2011
    Сообщений
    6

    По умолчанию

    Спасибо все заработало !

  7. #7
    Senior Member
    Регистрация
    16.10.2010
    Сообщений
    1,656

    По умолчанию

    Justbox, рады были помочь

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •