Home redirect 301 in apache 2.4 configuration (not in .htaccess) excluding one folder
Reply: 0

redirect 301 in apache 2.4 configuration (not in .htaccess) excluding one folder

user1360
1#
user1360 Published in July 21, 2018, 11:27 am

Coming from

Redirect 301 / https://www.example.com/

(in /sites-available/mydomain.conf)
is working. I now need to exclude only one folder.

RedirectMatch 301 "^(/(?!folder/).*)" / https://www.example.com/

is not working (apache is not restarting) :-(
I need it in the server *.conf not in the .htaccess!
Can anybody helps me?
Thank you!

Complete content of this configuration file is:

DocumentRoot /var/www/mydomain/

ServerName mydomain.com
ServerAlias www.mydomain.com

Redirect 301 / https://www.example.com/

AddDefaultCharset utf-8 

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

<Directory /var/www/mydomain/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require valid-user
    Require all granted
</Directory>

<IfModule mod_rewrite.c>
    # Rewrite all HTTP requests to HTTPS
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

ErrorLog ${APACHE_LOG_DIR}/mydomain.com.error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/mydomain.com.access.log combined
ServerSignature On

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.380718 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO