So i have to change a url in .htaccess for SEO purposes, i already have a .htaccess file on the home directory of the site…
do i need to make the changes on the .htaccess on the home directory or on the subdirectory that is the web page that i need to have a new URL???
This is the code i already have on the home directory
RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirect /public_html/cursos/YoutuberKids/index.php /public_html/cursos-
kids/Youtuber/index.php
and this is the actual URL of the page that must be changed:
https://www.viahavok.com.br/cursos/GameDesignPRO/
And i need to become this URL:
2
Answers
Why don’t you just change the name of the folder to ‘game-design-pro’? Changing the URL in
.htaccess
isn’t better or more effective when it comes to SEO in this case. (Unless I misunderstood your question?)Add this to the bottom of the .htaccess file in the home directory:
This will redirect all resources in the directory.
R=301
indicates that this is a permanent move for theresources.
[L] flag
causes mod_rewrite to stop processing the rule set.In most contexts, this means that if the rule matches, no further
rules will be processed.
[NC] flag
causes the RewriteRule to be matched in acase-insensitive manner.