Page redirection with .htaccess

I need to make a target, when the user access, https://www.dominio.com.br/portal/anything be directed to https://www.domain.com.br/blog

Is it possible to do this with .htaccess?

Here is the code I have:

<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} OPTIONS
    RewriteRule .* / [R=200,L]
    RewriteRule ^portal/([a-z0-9\-]+)/$ ^blog/ [QSA]
</ifModule>

Note: Inside the portal folder, I already have an index.php pointing to blog. This .htaccess would go inside this folder.

Upvotes: 0

Views: 20

Answers (1)

napuzba
napuzba

Reputation: 6288

<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^portal/(.*) blog/$1 [L,QSA]
</ifModule>

Upvotes: 1

Related Questions