Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to edit virtualhost file?

Discussion in 'General Discussion' started by greektranslator, Dec 6, 2018.

  1. greektranslator

    greektranslator Well-Known Member

    Joined:
    Jun 5, 2011
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    56
    Location:
    Greece
    cPanel Access Level:
    Root Administrator
    I have these instructions from here - Removed - for the virtual hosts of a specific site but I am not sure where and how to make the edit. I have used for the time being htaccess but I understand that it is better if it is in the vhosts file.

    This configuration is meant to go the same block as whatever VirtualHost or other directive you have your wiki's DocumentRoot, ServerName, etc... already defined in.

    To add this config:


    Code:
    RewriteEngine On
    RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
    
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
    RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]
    
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
    RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #1 greektranslator, Dec 6, 2018
    Last edited: Dec 6, 2018
  2. Infopro

    Infopro cPanel Sr. Product Evangelist Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,877
    Likes Received:
    482
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    That code is belongs in your htaccess file, IMO.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. greektranslator

    greektranslator Well-Known Member

    Joined:
    Jun 5, 2011
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    56
    Location:
    Greece
    cPanel Access Level:
    Root Administrator
    Right, I thought that by being in vhosts it means that the the system does not have to read every directory for an htaccess files, hence being more effective.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,141
    Likes Received:
    474
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice