S
S
skijaev2014-08-30 18:45:21
Apache HTTP Server
skijaev, 2014-08-30 18:45:21

How to set mod_rewrite rule in .htaccess to output type /category/article?

On the site, all urls will be of this type
domen.ru
domen.ru/category/
domen.ru/category/node/
domen.ru/category/
I want to lead them all to /index.pxp?r=site&cat=$1&cat=$2
tried so
RewriteRule
^(.+)/(.+)/$ /index.php?r=site&cat=$1&node=$2
didn't work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TANK_IST, 2014-08-30
@skijaev

RewriteEngine on
RewriteBase /
Options +FollowSymLinks -Indexes -ExecCGI -Includes

RewriteCond %{HTTP_HOST} ^www\вашсайт\.ua$ [NC]
RewriteRule ^(.*)$ http://вашсайт.ua/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !(favicon.ico)$ [NC]
RewriteRule ^.*$ index.php [L]

And all the data after yoursite.ua/ will be in the $_SERVER['REDIRECT_URL'] variable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question