Hugo Static for Migration
Use Hugo static section to handle migration from other platform such as Ghost or WordPress.
Background
I have multiple posts about using mod_rewrite / redirect in various web servers to handle difference in base usr when migrating from one blog platform to another.
But what about /index.php and /index.php/tag(from WordPress) or /tag(from Ghost). They are generating lot of 404 in web server log.
Old URL | New URL |
---|---|
/index.php | / |
/index.php/tag | /tags |
/tag | /tags |
Use Hugo /static/
You can create web server rules to handle them. But that is another 2 or 4 rules, depending on web server used and other rules already in place. And yes, they may conflict each other!
Luckily with Hugo there is a simpler solution then fiddling with web server rules. Your Hugo site directory tree should look similar to below:
|
|
/index.php/
Inside the static directory, create directory index.php:
|
|
Create index.php/index.html:
|
|
/index.php/tag/ and /tag/
Inside the static directory, create directory index.php/tag and tag:
|
|
Create index.php/tag/index.html and tag/index.html:
|
|
Conclusion
The static will be deployed into your public folder automatically when compiling the site. No web server rules required. This removes another layer of web server dependency from your site.