How to enable mod_rewrite for Apache in CentOS

How to enable mod_rewrite for Apache in CentOS

Date: 10-07-2021

CentOS 7 and later versions have mod_rewrite installed and enabled by default. Open terminal and run the below command to check if mod_rewrite is already enabled in your system.
# httpd -M | grep rewrite
If you see the output like below, mod_rewrite is already enabled in your CentOS linux.
rewrite_module (shared)

If not enabled, open Apache module configuration file by using following command.
#vi /etc/httpd/conf.modules.d/00-base.conf
check the below line
#LoadModule rewrite_module modules/mod_rewrite.so
and remove the # sign at its beginning, to enable mod_rewrite.
LoadModule rewrite_module modules/mod_rewrite.so
If you don’t find the above line, just add it to the configuration file and restart the apache service.

Thank you!

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Reply

Scroll to Top