Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safest way to create a default WordPress .htaccess file is to regenerate it from the WordPress dashboard: open Settings > Permalinks, select a permalink structure other than the default/plain option, and click Save Changes. WordPress writes the current rewrite rules into the file when it can create or update a writable .htaccess. If it cannot write the file, the same screen displays the rules so you can copy them into .htaccess yourself.

This process is for Apache-style hosting with mod_rewrite. It does not create an IIS web.config, and WordPress multisite does not perform the automatic .htaccess write described here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What “default WordPress .htaccess” means

WordPress does not use one permanent block of text that is identical on every installation. The generated content depends on your permalink structure and on where WordPress is installed. A site installed at the domain root receives different path values from a site installed in a subdirectory. Current WordPress releases can also add rules that older examples do not show.

For that reason, the reliable definition of a default file is the block WordPress generates for your own site. It appears between the markers # BEGIN WordPress and # END WordPress. Do not copy a block from an old tutorial when the Permalinks screen can generate the correct one for your installation.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

The WordPress-managed block normally enables rewriting, establishes the installation’s base path, excludes requests that already map to a real file or directory, and routes other requests to index.php for WordPress to process. The exact directives can change with the WordPress version, permalink setting, and installation path.

Before you generate the file

Confirm that the server uses Apache rewriting

This method assumes an Apache server, or a compatible server configuration that honors Apache .htaccess rules and has mod_rewrite enabled. Pretty permalinks require that rewrite module. On IIS, .htaccess is not the mechanism used for these routes; the equivalent configuration belongs in the server’s IIS routing configuration instead.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Know where the file belongs

Place .htaccess in the directory that contains the WordPress installation. On a normal root installation, that is the document root alongside files such as wp-admin, wp-content, and wp-includes. A subdirectory installation uses the subdirectory as its base, and the generated rules include that path.

Back up an existing file

If an .htaccess already exists, download or copy it before regenerating anything. WordPress updates only the section bounded by its two markers, but a backup protects custom redirects, security directives, or hosting rules if you need to restore them.

Method 1: Generate it from the WordPress dashboard

This is the preferred method because WordPress calculates the current rules for your version and installation path.

  1. Sign in to the WordPress administrator dashboard.
  2. Open Settings > Permalinks.
  3. Choose a permalink structure other than the default/plain option. A plain structure does not require the usual pretty-permalink rewrite block, so WordPress may not insert those rules while that option is selected.
  4. Scroll to the bottom and click Save Changes, even if you did not change another setting.
  5. Test a front-end page, a post, and an administrative URL in a new browser request.

Saving the page flushes the permalink rules. When .htaccess exists and is writable, WordPress replaces the contents of its own marked block with the rules for the selected structure. If the file is absent, WordPress may attempt to create it when pretty permalinks are activated. Whether that succeeds depends on the account and directory permissions supplied by your host.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What success looks like

In a successful automatic update, the Permalinks screen returns without asking you to edit a file, and previously broken pretty URLs begin resolving. You can inspect the file through your host’s file manager, SFTP, or another file-management tool. Keep any unrelated directives outside the WordPress markers because the next save can replace everything inside those markers.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Why selecting a non-plain structure matters

The default/plain permalink option can serve URLs without the front-controller rewrite rules used by pretty permalinks. Selecting a date, post-name, numeric, or other non-plain structure gives WordPress a reason to generate the rewrite block. The labels available in your dashboard can vary by WordPress version, but the important distinction is plain versus a pretty structure.

Method 2: Copy the rules when WordPress cannot write the file

When the file is missing, owned by another account, or not writable, WordPress normally shows a notice similar to “You should update your .htaccess now” and places the generated rules in a text box. Treat that text box as the authoritative content for your site.

  1. Leave Settings > Permalinks open and select the desired non-plain permalink structure.
  2. Click Save Changes.
  3. When WordPress displays the manual-update notice, select the entire contents of its text box, not just one or two lines.
  4. Open the WordPress installation directory in your host’s file manager or an SFTP client.
  5. Create a file named exactly .htaccess. It has no filename before the dot and no extension after htaccess.
  6. Paste the complete generated text into the file and save it as plain text.
  7. Return to the site and test a pretty URL, the home page, and /wp-admin/.

Do not substitute a block copied from an old article. The current text box reflects your selected structure and installation path, and newer WordPress versions can contain a rule that older examples omit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If your file manager will not create a dot file

Some local Windows tools make it difficult to create a filename beginning with a dot. Use the hosting control panel’s file manager, an SFTP client that supports dot files, or create the file locally with a tool that permits the exact name and then upload it. Confirm after uploading that the name is .htaccess, not .htaccess.txt.

Permissions and ownership

Developers commonly recommend permission mode 644 for .htaccess, but that is a common recommendation rather than a universal WordPress requirement. The web-server account must be able to read the file, and WordPress needs the necessary write access when you want dashboard regeneration. If the host controls ownership or blocks writes at the directory level, changing the numeric mode alone may not solve the problem; ask the host to correct ownership or use the manual method.

What the generated block does

Part of the block Purpose What to know
# BEGIN WordPress and # END WordPress Marks the section WordPress manages. WordPress can replace this section whenever you save Permalinks. Keep custom directives outside it.
Rewrite-engine and module guard Enables rewriting only when the required Apache module is available. The generated block is wrapped in an Apache IfModule condition so unsupported servers do not process those directives.
Base-path setting Tells Apache which URL path represents the WordPress installation. The value differs for a root install and a subdirectory install.
File and directory exclusions Leaves requests for real files and directories alone. The conditions commonly check that the requested path is not an existing file and not an existing directory.
Front-controller rule Sends remaining requests to index.php. WordPress then resolves the requested post, page, archive, or other route.
Version-specific additions Handles edge cases in newer releases. Some newer blocks skip index.php itself. Copy your current generated block rather than guessing which additions apply.

This table describes the function of the generated rules, not a replacement for the text WordPress displays. The exact syntax is intentionally installation-specific.

Root installation versus subdirectory installation

WordPress installed at the domain root

For an installation whose files are directly in the site’s document root, the base path is the root URL. The generated final rule therefore targets the root-level index.php. Do not add a directory name that is not part of the actual installation path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

WordPress installed in a subdirectory

If the files live in a directory such as /blog, the generated RewriteBase and final rewrite target include that path. A root-installation example pasted into a subdirectory site can produce failed links or redirect loops. Generate the block from that site’s own Permalinks screen so the path is calculated correctly.

Keep custom rules outside the WordPress markers

Redirects, access restrictions, cache directives, and other hand-written rules should appear before # BEGIN WordPress or after # END WordPress. If you place them inside the managed block, a future permalink save can delete or alter them. Put the most specific custom redirects before broad catch-all rules, and keep a backup before editing.

If a plugin or hosting panel has inserted its own managed section, do not merge unrelated directives into the WordPress section. Preserve each tool’s markers so that each system can update only the lines it owns.

Repair a missing or stale .htaccess file

Regenerate without changing the visible setting

A common first repair is to open Settings > Permalinks and click Save Changes again. This flushes the rewrite rules even when the permalink choice stays the same. Test the site immediately afterward.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rename the old file and create a fresh one

If the existing file contains stale or damaged WordPress rules, download it as a backup and rename it, for example to a non-active backup filename. Save the Permalinks screen again so WordPress can create a fresh .htaccess or display the manual text. Do not delete the backup until the site and any custom redirects have been checked.

When the dashboard still cannot update it

Use the complete text displayed by WordPress and save it manually. If that fails, verify the directory location, filename, ownership, and read permissions. A server that does not load mod_rewrite will not honor the generated Apache rules, even when the file itself is present.

Multisite and IIS limitations

WordPress multisite

WordPress’s automatic rewrite-file function does not run for multisite; the function returns no generated write result in that configuration. Multisite networks therefore require the network’s documented server configuration and any rules appropriate to the chosen subdirectory or subdomain setup. Do not assume that saving one site’s Permalinks screen will safely rewrite the network’s file.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

IIS hosting

IIS does not support Apache mod_rewrite or .htaccess processing. If the site is hosted on IIS, this guide’s file-generation method is not the route configuration you need. Use the IIS-compatible rewrite and routing configuration supplied for that server environment instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verification checklist after creation

  • Confirm the file is in the directory containing the WordPress installation.
  • Confirm its exact name is .htaccess, with no hidden .txt extension.
  • Confirm the selected permalink structure is not plain/default.
  • Open a published post or page directly, not only the home page.
  • Open an archive or another pretty URL to check that routing works across more than one request type.
  • Open /wp-admin/ and log in again if the test session expired.
  • Check that existing custom redirects still work.
  • If the file is rewritten again, verify that custom rules remain outside the WordPress markers.
  • If every pretty URL fails while the file looks correct, have the host confirm that Apache rewriting is enabled and that the server is actually reading this directory’s .htaccess.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common mistakes and their fixes

Using an old code sample

Symptom: The site has a block copied from a tutorial, but links still return 404 errors or behave differently from the dashboard’s current output.

Fix: Select the desired structure and save Permalinks. Use the full block WordPress generates for this installation and version.

Leaving the permalink setting on plain

Symptom: Saving the screen does not produce the expected pretty-permalink rules.

Fix: Select a non-plain structure, save again, and then inspect the file or manual text.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Editing inside the managed block

Symptom: A redirect or security rule disappears after a later permalink change.

Fix: Restore the rule from your backup and move it outside the two WordPress markers.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Creating the file in the wrong directory

Symptom: The file exists in the account’s home directory, but WordPress URLs are unchanged.

Fix: Move it to the web directory containing the WordPress files and regenerate the rules.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Expecting .htaccess to solve an IIS or module problem

Symptom: The file is present and readable, but Apache directives have no effect.

Fix: Identify the web server, then enable the required Apache rewrite module or use the server’s IIS-compatible configuration.

Which creation method should you use?

Situation Best method Reason
The file exists and WordPress can write it Dashboard generation It calculates and maintains the current block automatically.
The file is missing but the host permits creation Dashboard generation first WordPress may create it when pretty permalinks are activated.
The screen displays a manual-update notice Copy and paste the displayed text The text is tailored to the site’s structure and path.
You need custom redirects or server directives Either method, with custom rules outside the markers WordPress can regenerate its section without overwriting the separate rules.
The site is multisite Network-specific server configuration The automatic write function does not run for multisite.
The site runs on IIS IIS rewrite configuration .htaccess and Apache mod_rewrite are not used by IIS.

Frequently asked questions

Can I paste a “default” block from another WordPress site?

You can, but it may contain the wrong base path, omit rules present in your release, or assume a different permalink structure. Generate the block in the target site’s own Permalinks screen instead.

Does saving Permalinks change my posts or pages?

It changes the server rewrite rules used to resolve URLs. It does not rewrite the content of your posts or pages, but changing the public permalink structure can change their URLs and may require redirects.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I remove every existing line before pasting?

Only replace the WordPress-managed section when one is present. Preserve unrelated custom rules after backing up the file, and place future custom rules outside the managed markers.

Why does WordPress show the rules instead of saving them?

The file or its directory is not writable by the account WordPress uses, or the file is missing and the server prevents its creation. Copy the complete displayed block manually, then correct permissions or ownership if you want dashboard updates to work later.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.