Mobile app version of vmapp.org
Login or Join
Harper822

: I couldn't create .htaccess redirect From /etiket/(any page) to /konu/(any page). How can I do it? In .htaccess file. I searched and applied it but couldn't. # BEGIN WordPress <IfModule mod_rewrite.c>

@Harper822

Posted in: #301Redirect #Htaccess #ModRewrite #Redirects

From /etiket/(any page) to /konu/(any page).
How can I do it? In .htaccess file.

I searched and applied it but couldn't.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^etiket//?(.*)$ "https://example.com/konu/" [R=301,L]
</IfModule>
# END WordPress

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Harper822

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

You've put the redirect in the wrong place. It must go before the WordPress front-controller, otherwise, it will never execute.

You should avoid editing between the # BEGIN WordPress comment tags, otherwise, your customisations could be overwritten in a future update.

You also have a lot of unnecessary escaping (eg. no need to escape colons, slashes and dots in the RewriteRule substitution). Try something like the following instead:

RewriteRule ^etiket/(.*) example.com/konu/ [R=302,L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress


You will need to clear your browser cache before testing.

Only change the 302 (temporary) to 301 (permanent) when you are sure it's working OK to avoid any caching issues.

NB: The RewriteEngine On directive only needs to be included once in the file. And this can literally go anywhere in the file, so you can leave the WordPress block of directives as they are.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme