View RSS Feed

Naveed A Lodhi

How-to: Move htaccess rules into httpdconf from WHM

Rate this Entry
WHM , cPanel is one of the most widely used server control panels. If you are using WHM and you want to move your .htaccess rules to httpd.conf and if you have no knowledge about SSH usage you can use the following guide.

Login to your WHM panel by your root login located at https://www.yourdomain.com:2087

Look for [B]Service Configuration menu and browse for [B]Apache Configuration under Service Configuration menu.

Within Apache Configuration please look for [B]Include Editor

When you click on Include Editor , you'll be given 3 different choices.

  • Pre Main Include
  • Pre Virtual Host Include
  • Post Virtual Host Include

The include we need to use in here is [B]Pre Virtual Host Include . Please choose your apache version within Pre Virtual Host Include dropdown menu and add your .htaccess rules within the editor.

While adding the rules make sure you use your path correctly

# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine On

# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /

#RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
#RewriteRule (.*) http://www.yourdomain.com/forums/$1 [L,R=301]

RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]
You can add different rewrite rules for different folders.

When you are done adding rewrite rules click on Update button and then restart apache.

Credits: VBSEO



Total Trackbacks 0
Trackback URL:

Log in

Log in