2

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\/$1" [R=301,L]
</IfModule>
# END WordPress
2

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/(.*) https://example.com/konu/$1 [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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.