Personal portfolio site owners often need to decide which URL format will serve as their primary address. This guide explores the concept of unifying www and apex domains using permanent redirects, ensuring that visitors reach a single, consistent version of your site regardless of how they type the address.

Choosing between www and apex for your portfolio

This section is an invented example with an imagined author, kept separate from any real site or operator. Picture a designer preparing a simple portfolio for a fictional photographer: a home page, a short about page, and a selection of project pages.

The starting files are minimal: an index page, an about page, three project pages, and a plain style sheet. Before deciding which hostname to lead with, the designer writes down two candidate addresses. Candidate A uses the www form: www.portfoliodemo.example. Candidate B uses the apex form: portfoliodemo.example. Neither is registered for this exercise, and the spelling is only the author's record of a placeholder for the example. The project pages already use relative links, so their internal navigation does not depend on either candidate.

The designer then drafts a small content inventory to make the choice concrete:

Entry — Home / Field: page / Preferred path: index / Destination: starts at whichever candidate is chosen Entry — About / Field: page / Preferred path: about / Destination: one canonical version Entry — Projects / Field: section / Preferred path: projects/ / Destination: three child pages Entry — Contact note / Field: text / Preferred path: contact / Destination: displayed address, no separate mailbox assumed

Two clearly fictional records show how the inventory is read. Record one: “About — page — about — one canonical version.” Record two: “Projects — section — projects/ — three child pages.”

For the choice itself, the designer picks Candidate A, the www form, for the home page and all internal navigation in this example. The reason is consistency: the project links and the page currently in the draft all sit under that exact hostname, so only one version needs to be described in the portfolio's own content. Candidate B is noted as the alternative destination for a redirect from the other form, but within this example it is not presented as already working or proven to be preferable.

What remains for this example is a planned single hop: whichever address a visitor types, one fixed move leads to the chosen host. The names, records, and choice are self-made for explaining the problem; they are not a recommendation list, and they say nothing about how any real domain or server would behave.

Understanding the role of permanent status codes

Apache HTTP Server's mod_alias documentation states that its Redirect directive instructs clients to make a new request with a different URL, and is often used when a resource has moved. Without a status argument, the redirect is temporary, an HTTP 302 response. The permanent keyword returns status 301, described as indicating the resource has moved permanently. The same documentation says RedirectPermanent makes the redirect permanent, status 301, and is exactly equivalent to Redirect permanent.1

The status code you choose is part of the message, not just a technical detail. For the fictional designer in this example, a planned single hop from the non-chosen hostname to the chosen one should use a permanent code, so visitors and search engines both learn that the chosen address is the lasting one. You can note the code beside each inventory entry, for instance “About — permanent — moves to chosen host,” and keep it distinct from any temporary forwarding you might consider later for experiments.

You might draft two short URL lines for the home page and compare them aloud: one beginning with the www form and one beginning with the apex form. If the www line is chosen, the apex line becomes the source that permanently points to it; if the apex line wins, the roles reverse. For an archived notice, a different example set might use an old hostname pointing permanently to a current announcement page, while a separately labeled current entry keeps the chosen address as its own destination. Note that this second set is another condition example, not a rewrite of the first.

Consider recording, in your own notes, which addresses you will keep unchanged and which will permanently defer to the chosen host. Then review the planned hop against your inventory before publishing anything, since the choice belongs to you and the outcome is still hypothetical.

Configuring server-level redirect rules

In NGINX, the ngx_http_rewrite_module allows server-level configuration changes. The return directive stops processing and sends a specified code to the client. For permanent redirects, you can use the 301 status code with a redirect URL. This directive works in server, location, or if contexts. Alternatively, the rewrite directive uses regular expressions to change request URIs. Adding the permanent flag to a rewrite instruction returns a 301 redirect. These directives execute sequentially at the server level before location blocks are searched. Proper syntax ensures visitors typing non-canonical hostnames receive the correct permanent redirect response.2

You can turn the fictional designer’s chosen www host into a small server-level plan: write the hostname you keep, the hostname that should defer, and the exact destination path for each page. For the home page, the plan might read “keep www form; apex home defers to www home.” For a project page, “keep www form; apex project page defers to the matching www project page.” You might record these pairs in two columns and check that each destination names a real page in your own file list.

Consider drafting the redirect rule as a plain-language sentence before touching any server file: “A request for the apex home page should move once to the www home page.” The designer can compare that sentence with the chosen host and the status code already selected earlier, then revise any line that points to a page not in the inventory. If a project page is still a draft, you could mark it “hold” rather than invent a destination.

It helps to note which rules you will add now and which you will postpone. The designer might list three rules for the home, about, and projects pages, then set aside a fourth for a page planned later. Keep the notes short and dated so the future version can be compared with this one.

Using wildcard patterns for efficiency

Cloudflare ’s Single Redirects documentation states that dynamic redirects build the target URL from components of the original request. It describes a wildcard-based interface for defining source and target URL patterns without complex functions or regular expressions, and says this can handle thousands of URLs with a single rule.3

The same page notes that dynamic redirects also support string replacement operations and regular expressions, depending on the Cloudflare plan. It points to Snippets for more complex or customized redirect logic, and to the Rules simulator for checking whether a redirect rule triggers for a specific URL.3

According to the page, static redirects, by contrast, send users to a fixed target URL. These are the documented distinctions for Single Redirects; broader performance, SEO, or portfolio-specific outcomes are not stated there.3

For this next step, you can take the fictional designer’s list of individual page rules and consider which of them share a shape. Instead of writing a separate line for every project page, you might group them behind one pattern and keep the exceptions visible beside it.

Suppose the list currently has three entries: home, about, and projects. Draft a grouped version in plain words, such as “any request under the projects path moves once to the chosen www host,” then check whether home and about really belong in that group or deserve their own lines. You can record both versions side by side and note why one feels clearer. A grouped pattern may reduce repetition, but it can also hide a page that needs different handling.

The same approach works for archived announcements. For a current notice, you might write a pattern that covers notices published under one path; for an older archived notice, write a separate line and state its destination plainly. You can fill in example fields such as “match: notice path pattern,” “destination: current notice page,” and “note: archived version stays separate,” then replace the values with your own entries. Keep the archived line visible so it is not silently swallowed by the broader pattern.

Verifying redirect behavior with testing tools

Verification begins with the Rules simulator, which the source names as the tool for determining whether a rule triggers for a specific URL. Testing applies to a specific URL, not to the site as a whole.4

Redirect evaluation has its own stopping behavior. The source states that when multiple rules with the Redirect action match, Cloudflare always uses the URL redirect of the first rule that matches. It also notes that evaluation stops and the action executes immediately for terminating actions, including Redirect.4

Because the source lists Single Redirects ahead of Bulk Redirects in execution order, a redirect configured there applies first if a rule matches. Single Redirects and Bulk Redirects both require proxying the DNS records of the domain or subdomain through Cloudflare ; without that, the documented redirect behavior does not run.4

You can take the fictional designer’s plainer redirect sentence and verify it with a plain observational step before any tool enters the picture. Open the non-chosen address in a browser, watch whether the address settles on the chosen host, then compare that against what you planned. If the address stays put or jumps twice, the planned single hop is not yet what a visitor experiences. Consider recording three small fields in your own notes: the address typed, the address shown after loading, and whether the move looked like one step or several.

You might then prepare two short comparison rows, one for the home page and one for the projects path. Each row can hold an expected destination and an observed destination, written in ordinary words rather than as a technical report. For a fictional check, one row might read “apex home — expected www home — observed www home.” Another might read “apex projects — expected www projects — observed unchanged.” The second row is a useful failure example, not a prediction.

If you later use a header-inspection tool, treat it as a separate, optional observation and note which check it answers. You can decide after comparing your two rows whether a broader check is worth the trouble. Before any broader check, confirm that the three individual page rules from your plan are still the intended starting point.

Maintaining consistency across all site pages

You can take your own content inventory and turn it into one short consistency list before touching any server files. Write three columns in plain words: the page name, the path you plan to keep, and the path that should permanently defer to it. For a home page you might note “Home — index — root form” and for a contact page “Contact — contact — root form.” Leave any row blank if you genuinely have not decided yet; an honest blank is more useful than a guessed value.

Next, read your list against the links already written in your pages. You might open each page you have drafted and underline every internal link, then compare each one to the kept path in your list. If a link points at the deferring form, you can rewrite it to the kept form now, so future visitors avoid the extra hop even before the redirect exists. This is a plain editing task on your own text, and you can choose to do it page by page or all at once.

For the paths you keep unchanged, you can write a one-line note explaining why, in your own words. A note like “projects pages keep their own path because each project is a separate page” reminds you later why you did not fold everything into one pattern. These notes are for you, not for publication.

When you plan the permanent move, you might express each row as a sentence before any configuration: “A request for the root home form moves once to the projects-style host, and the path stays the same.” Read the sentence aloud and check that it names one starting form, one destination, and no second stop. If a sentence needs two “then” clauses, that is a sign the rule covers too much, and you can split it into two rows.

Finally, keep a small decisions log beside your inventory with the date and the reason for each choice. It need not be formal; a few lines per page will do. When you revisit the site months later, that log tells you which choices were deliberate and which were left open, so you can continue the same scheme rather than inventing a new one.

Frequently asked questions

What can I record in my own notes about which addresses stay unchanged and which defer to the chosen host?

Consider recording, in your own notes, which addresses you will keep unchanged and which will permanently defer to the chosen host.

How might I draft the redirect rule as a plain-language sentence before touching any server file?

Consider drafting the redirect rule as a plain-language sentence before touching any server file: “A request for the apex home page should move once to the www home page.” The designer can compare that sentence with the chosen host and the status code already selected earlier, then revise any line that points to a page not in the inventory.

What three plain-word columns can I write to turn my content inventory into a consistency list?

You can take your own content inventory and turn it into one short consistency list before touching any server files. Write three columns in plain words: the page name, the path you plan to keep, and the path that should permanently defer to it.