Alias limitations

It seems as if there are some undocumented limitations of the alias feature. I can’t seem to create an alias for

/?page_id=123

Maybe not that easy to accomplish though? This is an URL schema from Wordpress.

There are multiple parts of a URL. Just focusing on two of them that are relevant, the path (including the filename) and the querystring.

For the url you’ve presented here the path is index.php (or index.html) and the querystring is ?page_id=123 . You don’t see the filename because the webserver has been configured to hide the index.html or index.php part.

As we are just generating file names we cannot route things based on the query string in Hugo.

If you want to keep this URL scheme you will need to add a router to route the dynamic requests to the static hugo files. Nginx can do this pretty easily.

It’s definitely out of the scope of what Hugo should do unfortunately.

Of course you’re, didn’t think it through :slight_smile:

Might be an idea to note this in the docs, or print a warning on generation.

For my specific need, I will add redirect rules to S3.

Good idea. It should give a warning if it finds a url that it can’t actually write to disk or is invalid. Right now I think we just take the approach of stripping invalid characters and writing to what’s left.