{"id":1302,"date":"2017-04-02T08:58:35","date_gmt":"2017-04-02T03:28:35","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=1302"},"modified":"2018-06-08T12:00:33","modified_gmt":"2018-06-08T06:30:33","slug":"enable-mod-rewrite-module-apache-2-4-ubuntu","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/enable-mod-rewrite-module-apache-2-4-ubuntu\/","title":{"rendered":"Enable mod rewrite module on Apache 2.4 Ubuntu"},"content":{"rendered":"<h2>Enable mod rewrite module on Apache 2.4<\/h2>\n<p><strong>Date Posted:01-04-2017<\/strong><\/p>\n<p>Mod rewrite is an essential module for\u00a0<em>.htaccess\u00a0<\/em>rules to work on apache server.\u00a0Follow the below post incase apache is not installed on host.<\/p>\n<p><a href=\"https:\/\/pheonixsolutions.com\/blog\/install-apache-2-4-php5-6-ubuntu-16-04\/\">Install Apache 2.4 on Ubuntu<\/a><\/p>\n<h4>Implementation:<\/h4>\n<p>Login to the server as root.<\/p>\n<p>Execute the below command to enable the mod_rewrite module.<\/p>\n<p><code>a2enmod rewrite<\/code><\/p>\n<p>Restart apache service to make the effect.<\/p>\n<p><code>service apache2 restart<\/code><\/p>\n<p>If you followed the above post, there will be a default configuration\u00a0<em>000-default.conf.\u00a0<\/em>Open the file and add the following content.<\/p>\n<p><code>vi \/etc\/apache2\/sites-enabled\/000-default.conf<\/code><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;Directory \/var\/www\/html\/&gt;\r\n                Options Indexes FollowSymLinks MultiViews\r\n                AllowOverride All\r\n                Order allow,deny\r\n                allow from all\r\n&lt;\/Directory&gt;<\/pre>\n<p>If the documentroot is different other than\u00a0<em>\/var\/www\/html\u00a0<\/em>then replace it with appropriate directory.<\/p>\n<p>Restart apache service for the changes comes into effect.<\/p>\n<p><code>service apache2 restart<\/code><\/p>\n<h4>Verification:<\/h4>\n<p>1. Execute the below command and look for rewrite module in the output.<\/p>\n<p><code>apachectl -M|grep rewrite<\/code><\/p>\n<p>2. Create a <em>.htaccess<\/em> on the directory and add simple rewrite rule.<\/p>\n<p><code>vi\u00a0\/var\/www\/html\/.htaccess<\/code><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">RewriteEngine on<\/pre>\n<p>Access the domain or IP address (<em>http:\/\/IPAddress)\u00a0<\/em>on the browser. If you see <strong>500<\/strong>\u00a0internal error then there is a problem with rewrite module.<\/p>\n<p>Look for any error while accessing the page on browser using below command. If you see any error related\u00a0<em>Rewrite\u00a0<\/em> then there is a problem with rewrite module.<\/p>\n<p><code>tail -fn0 \/var\/log\/apache2\/error_log<\/code><\/p>\n<p>Incase of any issue then please comment here.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Enable mod rewrite module on Apache 2.4 Date Posted:01-04-2017 Mod rewrite is an essential module for\u00a0.htaccess\u00a0rules to work on apache [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[278,274],"class_list":["post-1302","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-apache","tag-ubuntu","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-l0","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1302"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1302\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}