Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteiTechGuides 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
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
To enable mod_rewrite on CentOS, first verify that Apache httpd has the rewrite module loaded. Then turn on the rewriting engine with RewriteEngine On in the server configuration, the relevant virtual host, or the directory where your rules run. If you use .htaccess, the enclosing <Directory> block must allow the required overrides; AllowOverride None causes Apache to ignore the file completely.
The safest workflow is to identify the active configuration, confirm the module, choose the narrowest suitable configuration context, run Apache’s configuration test, reload httpd, and then check the actual HTTP response and logs. The file names and include layout can differ between CentOS releases and customized installations, so verify the active paths instead of assuming one fixed file.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →What mod_rewrite does and what must be enabled
mod_rewrite is Apache’s URL-rewriting module. It can redirect one URL to another, route requests to an application entry point, add or remove URL components, and make decisions based on conditions such as the requested file or host. Loading the module only makes the directives available; it does not activate rule processing. The runtime engine is controlled separately by RewriteEngine, which is off until you set RewriteEngine On.
Apache supports rewrite directives in server configuration, virtual-host configuration, directory sections, and .htaccess files. The context determines which requests the rules see, what permissions are needed, and how patterns are matched. Rewrite settings are not inherited by virtual hosts by default, so every virtual host that needs rewriting must enable the engine in its own configuration.
#1 Best Overall
- 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 three checks that solve most setup problems
- Module check: Apache must load
rewrite_module, normally through a declaration such asLoadModule rewrite_module modules/mod_rewrite.so. - Engine check: The configuration context containing the rules must include
RewriteEngine On. - Permission check: Rules in
.htaccessare read only when the enclosing directory permits the relevant overrides.AllowOverride Nonedisables.htaccessprocessing.
Before changing Apache on CentOS
You need administrative access to the server, the Apache httpd package installed, and a way to edit its active configuration. If you do not control the global Apache configuration, a hosting administrator may need to make the module or AllowOverride change for you.
Identify the active installation
- Confirm the package and binary that provide Apache. For example, run
rpm -q httpdandhttpd -v. These commands help distinguish the installed release from a different binary on the path. - Inspect
/etc/httpd/and the configuration files it includes. Common installations keep the main configuration in/etc/httpd/conf/httpd.conf, with module declarations or additional configuration under subdirectories such asconf.dorconf.modules.d. A customized server may use a different include arrangement. - Make a copy of any file before editing it and preserve the distribution’s existing include structure. Do not add a second
LoadModule rewrite_moduleline if one is already active.
Check the currently loaded modules
Use the Apache binary or control script supplied by the installation to list loaded modules, then look for rewrite_module. Typical commands are httpd -M | grep rewrite or apachectl -M | grep rewrite. The exact output format is less important than seeing the rewrite module in the active module list. If the command reports an error, run the configuration test first and correct that error before interpreting the module list.
Choose the right configuration context
When you control Apache, server or virtual-host configuration is generally the cleanest choice. It keeps rules centralized, lets you validate the complete configuration before a reload, and avoids a directory-by-directory filesystem lookup on every request. Use .htaccess when a site or application must manage its own rules without access to the main configuration, or when per-directory delegation is an intentional part of the deployment.
| Consideration | Server or virtual host | Directory or .htaccess |
|---|---|---|
| Administrative control | Requires permission to edit Apache configuration. | Can be delegated to a directory owner, subject to the enclosing AllowOverride policy. |
| Scope | Applies to the server or a selected virtual host. | Applies to a directory and its request processing context. |
| Inheritance | Rules are not automatically inherited by other virtual hosts; enable the engine in each one that needs it. | Rules apply only where the file is found and allowed. |
| Override permissions | No AllowOverride setting is needed for the directives placed directly in the server configuration. |
The enclosing <Directory> must permit the required directive groups; AllowOverride None ignores the file. |
| Symbolic-link option | Set the required Options in the server or virtual-host configuration. |
Per-directory rewriting requires an appropriate FollowSymLinks or SymLinksIfOwnerMatch setting, and changing that option in .htaccess also requires the applicable override permission. |
| Validation | All rules can be checked centrally with the httpd configuration test. | A syntactically valid main configuration can still contain an ignored or disallowed .htaccess, so directory permissions must be checked separately. |
Enable and verify the rewrite module
1. Locate the module declaration
Search the active Apache configuration for rewrite_module and LoadModule. A common declaration is:
LoadModule rewrite_module modules/mod_rewrite.so
The relative module path is resolved according to Apache’s configured server root and module directory. Keep the path used by your CentOS installation rather than replacing it with a path copied from another server. If the declaration already exists in an included module file, do not duplicate it in httpd.conf.
2. Add the declaration only when it is absent
If the module is installed but not loaded, add the distribution-appropriate LoadModule rewrite_module line to the active module configuration. If no matching module file exists, verify the installed httpd package and module set before creating configuration. A missing or incompatible shared object must be fixed at the package level; a rewrite rule cannot compensate for a module that Apache cannot load.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- 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
3. Test before reloading
Run the platform’s Apache configuration test, commonly sudo apachectl configtest or sudo httpd -t. Proceed only when it reports a successful syntax result. An error such as Invalid command RewriteEngine usually means the active configuration still has no loaded rewrite module, while a syntax error on the LoadModule line points to a path or package problem.
Enable mod_rewrite in a virtual host or server configuration
Use this method when you administer Apache and want predictable, centrally validated behavior. Put the engine and rules inside the specific <VirtualHost> that should process them, or in the server configuration when the rule truly belongs to every site.
Example virtual-host configuration
<VirtualHost *:80>
ServerName example.test
DocumentRoot /var/www/example
RewriteEngine On
RewriteRule ^/old-path$ /new-path [R=301,L]
</VirtualHost>
The example redirects an exact request for /old-path to /new-path. Replace the host, document root, and rule with values for your site. A permanent redirect is cached by clients and intermediaries, so use a temporary redirect while developing a rule if you may still change the destination.
Enable the engine separately for every site that needs it
Do not assume that a rule in one virtual host will become active in another. Apache does not inherit rewrite configurations by default. If two virtual hosts require similar behavior, place RewriteEngine On and the appropriate rules in each relevant block, or deliberately centralize a server-level rule when its scope is genuinely global.
Free tools Windows power users keep installed
One-click scans. No signup required.
Add conditions when the rule needs a decision
Conditions are evaluated before the rule. For example, a host-specific redirect can be written as:
<VirtualHost *:80>
ServerName example.test
RewriteEngine On
RewriteCond %{HTTP_HOST} =old.example.test
RewriteRule ^/account$ https://new.example.test/account [R=302,L]
</VirtualHost>
This is an illustrative pattern: it redirects only the matching host and path, and uses a temporary status while the behavior is being verified. Use the status code and destination that match your deployment policy.
Rank #3
- 【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.
Validate and reload
- Save the virtual-host file.
- Run
sudo apachectl configtestorsudo httpd -tand correct every reported error. - Reload Apache with the service manager, commonly
sudo systemctl reload httpd. If the installation does not support a graceful reload, use its documented restart operation instead. - Request a URL that should match the rule and inspect the response. For a redirect,
curl -I http://example.test/old-pathdisplays the status andLocationheader without downloading the page.
Enable mod_rewrite with .htaccess
.htaccess rules are processed only when Apache is configured to read them. The most common reason for an apparently broken rule is an enclosing <Directory> block containing AllowOverride None. In that state Apache ignores the file completely, including a correctly written RewriteEngine On.
Permit the required override groups
The rewrite directives belong to the FileInfo override group. The group covers RewriteEngine, RewriteOptions, RewriteBase, RewriteCond, and RewriteRule. A directory configuration can therefore allow the rewrite directives with:
<Directory /var/www/example>
AllowOverride FileInfo
Require all granted
</Directory>
Merge this with the site’s existing access and options policy rather than blindly replacing it. If the .htaccess file must set Options FollowSymLinks or Options SymLinksIfOwnerMatch, the directory policy must also permit the relevant Options override. A server-level Options setting may be preferable when you control the main configuration.
Place the file in the correct directory
Put .htaccess in the document-root directory or in the subdirectory whose requests it should affect. Apache searches according to the directory path, so a file in a parent directory and one in a child directory do not have identical scope. Confirm the filename is exactly .htaccess, including its leading dot, and that the active virtual host’s document root is the directory you edited.
Turn on rewriting in the file
RewriteEngine On
RewriteRule ^legacy-page$ /new-page [R=302,L]
In per-directory and .htaccess context, Apache removes the directory prefix before matching the RewriteRule pattern. The pattern therefore normally does not begin with a slash. The same redirect written in a virtual-host context commonly uses ^/legacy-page$ because the URL-path context is different.
Use conditions for front-controller applications
A common application pattern sends requests that are not real files or directories to an application entry point:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRank #4
- 【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.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
This example is only appropriate for an application that has an index.php entry point in the same directory. The two conditions preserve direct access to existing files and directories; the rule then routes other paths. Follow the application’s own routing requirements before applying a generic front-controller rule.
Check the symbolic-link requirement
Per-directory rewriting requires an appropriate FollowSymLinks or SymLinksIfOwnerMatch option. If Apache reports an options-related error, inspect both the effective Options setting and the AllowOverride permissions. Setting an option inside .htaccess can fail even when FileInfo is allowed, because options belong to a different override group.
Test a rewrite without guessing
Check the HTTP status and headers
Use a request that is known to match the rule. For a redirect, run curl -I http://host.example/old-path and inspect the status line and Location header. A redirect rule should produce the status you selected and a destination that is exactly what you intended. Follow redirects separately with curl -IL when you need to inspect the complete chain.
Distinguish a redirect from an internal rewrite
A rule using an R flag tells the client to request another URL, so the response includes a redirect status and usually a Location header. A rule without R can map the request internally while leaving the browser’s address unchanged. Test the application response as well as the address bar; a successful internal rewrite may not produce a visible redirect.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Review the configured error log
If the result is unexpected, inspect the error log for the active virtual host or server. Many CentOS installations use a file under /var/log/httpd/, but custom virtual hosts may define another path. Look for syntax errors, permission or options errors, rewrite-loop messages, and the exact request that triggered the problem. Do not treat a browser cache or a previously cached permanent redirect as proof that the current rule is correct.
Troubleshooting common failures
RewriteEngine is an unknown directive
- Confirm that the active module list contains
rewrite_module. - Check that the
LoadModule rewrite_module modules/mod_rewrite.sodeclaration is in an included configuration file, not merely in an unused file. - Run the configuration test and fix module-load errors before reloading.
- Make sure the command is testing the same Apache installation that the service manager starts.
Rules in .htaccess are ignored
- Inspect the enclosing
<Directory>block forAllowOverride None; that setting makes Apache ignore.htaccessfiles completely. - Permit the
FileInfooverride group for rewrite directives. - Confirm that the file is in the active document-root path and is named exactly
.htaccess. - Check whether a deeper directory contains another file or configuration that changes the effective behavior.
The rule works in one virtual host but not another
Enable the engine and place the rule in every virtual host that needs it. Rewrite configurations are not inherited between virtual hosts by default. Also verify that the request is reaching the expected virtual host by checking the hostname, port, and virtual-host definitions.
Best Value
- 【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.
Apache reports an options or symbolic-link error
Check for Options FollowSymLinks or Options SymLinksIfOwnerMatch in the effective directory configuration. If the setting is in .htaccess, ensure the directory allows the corresponding options override as well as FileInfo. If the server administrator does not permit that option, move the rule into server or virtual-host configuration where the option can be set centrally.
A pattern does not match even though the URL looks correct
Check the configuration context. In server or virtual-host context, the pattern sees the URL path with its leading slash. In directory and .htaccess context, Apache removes the directory prefix before matching, so the pattern normally has no leading slash. Also check whether the rule is being applied in a child directory, whether a preceding rule stops processing, and whether the requested path includes a trailing slash or an unexpected URL-encoded character.
The browser reports a redirect loop
Inspect every redirect rule in the request path, including rules in parent and child directories and in the virtual-host configuration. Compare the condition with the actual request scheme, host, and path. Temporarily use a non-cached redirect status while diagnosing, then clear cached permanent redirects after correcting the rule.
Configuration testing succeeds but the request is unchanged
- Successful syntax validation does not prove that a rule is in the context handling the request.
- Confirm that
RewriteEngine Onappears in that context. - Verify that the request reaches the intended virtual host and directory.
- For
.htaccess, recheckAllowOverride, the document-root path, and the symbolic-link option. - Review the error log and test with
curlto avoid browser caching or client-side assumptions.
Operational guidance for reliable rules
Prefer centralized configuration when you administer the server
Server and virtual-host rules make the effective policy visible in one place and allow a complete configuration test before reload. They also avoid relying on per-directory override permissions. This is usually the better operational choice for a server hosting multiple applications or sites.
Use .htaccess deliberately
.htaccess is useful when a project needs delegated control, but every request in the affected path depends on Apache discovering and reading the file. Document the required AllowOverride and Options settings with the application so a future server hardening change does not silently disable its routes.
Keep rule scope and termination explicit
Anchor exact matches with ^ and $ when appropriate, use conditions only for facts the request actually supplies, and choose flags such as L or an application-specific termination flag intentionally. A broad rule placed at server level can affect unrelated virtual hosts; a narrow rule in the correct virtual host is easier to reason about.
Make changes in a reversible order
- Record the current configuration and identify the file that is included by the running service.
- Load or verify the module.
- Add
RewriteEngine Onand one narrowly scoped rule. - Run the configuration test.
- Reload Apache only after a successful test.
- Check the response and log, then add additional conditions or rules one at a time.
CentOS mod_rewrite checklist
httpdis installed and the service uses the configuration you edited.rewrite_moduleappears in the active module list.- The relevant context contains
RewriteEngine On. - Each virtual host that needs rewriting enables its own engine.
- An enclosing
AllowOverride Noneis not blocking the.htaccessfile. - The
FileInfooverride group is allowed for rewrite directives. - Per-directory rewriting has an approved
FollowSymLinksorSymLinksIfOwnerMatchoption. - The rule’s pattern matches the selected context, especially the leading-slash difference.
apachectl configtestorhttpd -tsucceeds before reload.- A real request confirms the status, destination, or application response, and the configured error log is checked when behavior differs from expectation.
Conclusion
Enabling mod_rewrite on CentOS is a two-part task: load the Apache rewrite module and enable the rewrite engine where the rules run. For centrally managed servers, use the relevant server or virtual-host configuration. For delegated per-directory rules, configure the enclosing directory to allow FileInfo and the required symbolic-link option, then place a correctly scoped .htaccess file in the active document path. Always validate the complete Apache configuration before reloading and verify the result with an actual HTTP request.
Quick Recap
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.

