How to redirect all requests to another site in apache?

Hello, dear.
Domain name site.ru must all requests of type
site.ru
site.ru/sdfgdfg
site.ru/1/1/1
etc. to redirect to the Facebook group vk.com/group.

Made in the config site on Apache
Redirect permanent / vk.com/group/
but it redirects the request site.ru/1/1/1 on vk.com/group/1/1/1 and Vkontakte, respectively, is responsible 404-oops.
As I understand it, correct to do the 301-th redirect to mod_rewrite, but then how should look like the line RewriteRule?
October 3rd 19 at 03:51
1 answer
October 3rd 19 at 03:53
Solution
RewriteEngine on
RewriteBase /
RewriteRule ^(.*) http://vk.com/group/ [R=301,L]

I think so
Something went wrong:

root@7th_odroid:/etc/apache2/sites-available# service apache2 restart [FAIL] Restarting web server: apache2 failed!
[warn] The apache2 configtest failed. ... (warning).
Output of config test was:
AH00526: Syntax error on line 7 of /etc/apache2/sites-enabled/site.EN:
RewriteBase: only valid in per-directory config files
Action 'configtest' failed.
- Kylie49 commented on October 3rd 19 at 03:56
All right, he says — don't write me in the config that must be .htaccess of the root of the site.

Restart edit .htaccess does not require - Delpha_Kilback commented on October 3rd 19 at 03:59
Mm. Do we have to do .htaccess? I had hoped to do the config... - Kylie49 commented on October 3rd 19 at 04:02
Judging by the reaction of the Indian, Yes :) - Delpha_Kilback commented on October 3rd 19 at 04:05
To config that thing dug, but I never use it
RedirectMatch (.*) http://vk.com/group/ - Delpha_Kilback commented on October 3rd 19 at 04:08
Do I understand correctly — replace
RewriteBase /
on
RedirectMatch (.*)
?
This course swears
RedirectMatch takes two or three arguments, an optional status, then a regular expression and destination URL
- Kylie49 commented on October 3rd 19 at 04:11
Or rather that's the way it should be
RedirectMatch permanent (.*) <a href="http://vk.com/group/">http://vk.com/group/</a>
- Delpha_Kilback commented on October 3rd 19 at 04:14
It — perfect! Thank you!
This line does not add allegedly useful for search engines, the number 301? :) - Kylie49 commented on October 3rd 19 at 04:17
or so...
RedirectMatch permanent ^(.*) <a href="http://vk.com/group/">http://vk.com/group/</a>
- Delpha_Kilback commented on October 3rd 19 at 04:20
Yes, the error was in the first regular season, the last should work - Delpha_Kilback commented on October 3rd 19 at 04:23
so setting permanent 301 and generates - Delpha_Kilback commented on October 3rd 19 at 04:26
Thank you! - Kylie49 commented on October 3rd 19 at 04:29
rewrite is also best to write in httpd.conf, but in
<directory>
rewite...
</directory>
- kaycee.Torphy commented on October 3rd 19 at 04:32

Find more questions by tags Apache