A
A
atHome2017-06-07 15:45:23
htaccess
atHome, 2017-06-07 15:45:23

How to write RewriteRule gallery?s=blabla -> gallery/blabla?

Hello.
Can you please tell me how to correctly register RewriteRule in htaccess?
It is necessary that when visiting the site.ru/gallery/blabla page, the content is loaded from the site.ru/gallery?s=blabla page.
I tried to do this . Tell me
RewriteRule gallery?s\= gallery\/ [L]
how to write it correctly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-06-07
@atHome

It's not entirely clear what exactly needs to be done, here are the options.

# 301 --- http://site.ru/gallery?s=blabla => http://site.ru/gallery/blabla
RewriteCond %{QUERY_STRING} (^|&)s\=blabla($|&)
RewriteRule ^gallery$ /gallery/blabla? [L,R=301]

If you need it the other way around, then most likely you decided to make your own blackjack, well, you know..
Then you need to find out what CNC is
.
case will be different.
RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-l
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
        RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
        RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

Describe the task in more detail.
Do the urls change or is it 1 ?
do you need a 301 code or will 200 go
Should the link in the browser change?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question