I want to re-name a directory. How do I redirect so that my existing links aren't broken? #22301
-
Trying to search google for this has me frustrated. can anyone help re-structuring site directory without breaking existing links? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can do this via two ways, by using the terminal or the GitHub web interface. Using the terminal: 1.) Clone your repository that you website is hosted on. 2.) cd “repositoryname” 3.) git mv “directoryname” “newdirectoryname” 4.) git add . 5.) git commit -m “message” 6.) git push This is the easiest way, by using the terminal. Click here for a video of me doing this using the terminal. However, if you want to do it using the web interface, you can achieve the same results, but it requires more time and it is very tedious if there is a lot of files in that directory. You just have to open every single file in that directory, go to the first letter of the file name and backspace. This should remove that “/” from the path, and you will have to rename every single file’s directory like that. Here is a video if you need help. |
Beta Was this translation helpful? Give feedback.
-
sorry, I didn’t explain myself completely. What I mean, is I want to change the name of a folder within the repository and I want the links that breaks to be re-directed to the new location of the resource. For example, I want infominer.id/podcast-transcripts/index.html to redirect to the new location infominer.id/transcripts/index.html. [edit] Looks like I’ve found my answer, finally: https://help.github.com/en/articles/redirects-on-github-pages |
Beta Was this translation helpful? Give feedback.
sorry, I didn’t explain myself completely.
What I mean, is I want to change the name of a folder within the repository and I want the links that breaks to be re-directed to the new location of the resource.
For example, I want infominer.id/podcast-transcripts/index.html
to redirect to the new location infominer.id/transcripts/index.html.
[edit]
Looks like I’ve found my answer, finally:
https://help.github.com/en/articles/redirects-on-github-pages