skip to Main Content

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:

https://www.viahavok.com.br/cursos/game-design-pro

2

Answers


  1. 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?)

    Login or Signup to reply.
  2. Add this to the bottom of the .htaccess file in the home directory:

    RewriteRule ^cursos/GameDesignPRO/(.*)$ /cursos/game-design-pro/$1 [R=301,NC,L]
    

    This will redirect all resources in the directory.

    • The R=301 indicates that this is a permanent move for the
      resources.
    • The [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.
    • The [NC] flag causes the RewriteRule to be matched in a
      case-insensitive manner.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search