Query redirect problem in permalinks

When permalinks enabled, the query object is changed and returns only
the slug name. This commit solves this problem, so the restricted login
redirect pages work correctly.