The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to activate mod_rewrite

Discussion in 'General Discussion' started by mms, Aug 26, 2010.

  1. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hello
    How can i activate mod_rewrite

    there's only one code working
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^my ip [NC]
    RewriteRule ^(.*)$ /~ll22ll/upload$1 [L,R=301]

    =================================My htaccess=============
    # -FrontPage-

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName ll22ll.com
    AuthUserFile /home/ll22ll/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/ll22ll/public_html/_vti_pvt/service.grp

    <IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
    </IfModule>


    RewriteEngine on
    ExpiresActive On
    ExpiresByType image/gif "access 1 week"
    ExpiresByType image/jpg "access 1 week"
    ExpiresByType image/jpeg "access 1 week"
    ExpiresByType image/png "access 1 week"
    ExpiresByType application/x-shockwave-flash "access 1 week"
    ExpiresByType application/x-javascript "access 1 week"


    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^my ip [NC]
    RewriteRule ^(.*)$ /~ll22ll/upload$1 [L,R=301]

    it's not working i get 404 page
    RewriteEngine on
    RewriteRule ^view\/([0-9]+)\/(.*)$ do.php?id=$1
    RewriteRule ^download\/([0-9]+)\/(.*)$ do.php?id=$1
    RewriteRule ^delete\/([0-9]+)\/(.*)$ go.php?go=del&cd=$2
    RewriteRule ^([0-9]+)/folder/([0-9]+)$ index.php
    RewriteRule ^([0-9]+)$ index.php
    RewriteRule ^status.php$ go.php?go=rules
    RewriteRule ^status.php?do=status$ go.php?go=stats



    i Spock with the support they told me
    Hello,

    you will need to check apache documentation for mod_rewrite.

    Ticket Details
    how

    thanks
     
    #1 mms, Aug 26, 2010
    Last edited: Aug 26, 2010
  2. kuldeep_

    kuldeep_ Well-Known Member

    Joined:
    Apr 24, 2010
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    If you are sure that rules you have mentioned are correct then refer to following steps:

    If you have root access to server then check if mod_rewrite is enabled on server.

    To check use following command.
    If mod_rewrite is installed and still rules not working then try placing the rule in the top section of .htaccess file. Or comment out other rules for checking and only keep rules active that are not working and give it a try.
     
  3. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    mod_rewrite is included by default

    mod_rewrite is included by default in the Apache that is built by EasyApache. It is compiled in so there is no LoadModule or AddModule directive in the httpd.conf file. To confirm that it is present, you can use httpd -l and then use grep to narrow down the output:

    Code:
    # /usr/local/apache/bin/httpd -l|grep rewrite
      mod_rewrite.c
    mod_rewrite uses regex to match patterns. What I would suggest is using an online mod_rewrite testing tool to evaluate the patterns you are trying to use. A Google search for "mod_rewrite tester" returned some good possibilities at the top of the search results, such as the following:

    Test your RewriteRules for Apache mod_rewrite
     
  4. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    /root$ httpd -l |grep mod_rewrite
    mod_rewrite.c

    Linux Apache mod_rewrte Test Tutorial

    Please Give Us Your Comments

    LINK 1 = LINK 1 Does NOT use Mod Rewrite. LINK 1 uses standard URL: rewrite.php?link=1
    i get
    You are not using mod_rewrite - Try LINK2

    LINK 2 = LINK 2 - Yes, Uses Apache's Mod Rewrite using this URL:: link2.html
    404 Not Found

    The server can not find the requested page:
    My ip/~ll22ll/link2.html (port 80)

    Apache Error logos
    Code:
    [Thu Aug 26 13:26:39 2010] [error] [client ] File does not exist: /usr/local/apache/htdocs/home
    [Thu Aug 26 13:26:45 2010] [error] [client my ip] File does not exist: /home/ll22ll/public_html/upload/sys_cpanel, referer: http:///~ll22ll/upload/status.php
    
    [Thu Aug 26 13:40:48 2010] [error] [client my ip] File does not exist: /usr/local/apache/htdocs/home
    [Thu Aug 26 13:40:48 2010] [error] [client my ip] File does not exist: /home/ll22ll/public_html/sys_cpanel, referer: http:///~ll22ll/link2.html
    Hello................
     
  5. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Have you ensured the desired URL can be accessed directly, before setting the redirect to use it in the Apache .htaccess file? The URL being entered requires mod_userdir URLs to be allowed/enabled, but this can only be configured via root (Administrator) access to WebHost Manager (WHM) or manually via root SSH/console access.

    Please test to verify if you can access URLs like the following without receiving an error; replacing "$server" with the server hostname or IP address and replace "$username" with your cPanel account username:
    Code:
    http://$server/~$username/
     
  6. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    it's working fine
    my ip/~ll22ll

    but after i add this line in http.conf
    PHP:
    LoadModule rewrite_module modules/mod_rewrite.so 
    i get after i tried to restart
    Restarting Apache Web Server

    Apache restart failed. Unable to load pid from pid file and no httpd process found in process list.

    If apache restart reported success but it failed soon after, it may be caused by oddities with mod_ssl.

    You should run /scripts/ssl_crt_status as part of your troubleshooting process. Pass it --help for more details.

    Also be sure to examine apache's variouse log files.
    Apache Restart Output:
    httpd: Syntax error on line 38 of /usr/local/apache/conf/httpd.conf: module rewrite_module is built-in and can't be loaded

    Log:
     
  7. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    There is no extra configuration required in order to load "mod_rewrite" -- this module is compiled-into Apache when built/installed by EasyApache.

    I recommend using a redirect destination of a domain name installed on the cPanel account instead of attempting to use mod_userdir URLs. Attempting to use mod_userdir and mod_rewrite can easily incur unnecessary difficulty.

    What was used to configure your custom redirects? Were the entries input manually into the Apache .htaccess file(s) or were they setup by a script or some other method?
     
  8. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I just try to log in into cpanel by
    http://my ip /cpanel
    500 Internal Server Error ?
    i can only log in cpanel
    by
    my ip:2026
     
  9. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    I recommend contacting your web hosting service provider so that they may assist with troubleshooting difficulty accessing cPanel; the service provider will have direct access to the server and they are in the best position to investigate and apply any necessary corrections.
     
  10. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    When i try to update the

    Easy::Apache v3.2.0 Build 5186

    on
    # 5. Short Options List
    # →
    # 6. Exhaustive Options List


    there no option to activate the Mod_rewrite

    whhhhhhhhhhhhhy
     
  11. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    As previously indicated, there is no additional configuration required to load the Apache/httpd module "mod_rewrite"; by default, mod_rewrite is -always- installed by EasyApache and it is not optional.
     
  12. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Okay but after i update the Apache
    i get
    easyapache3] Build Failure: Build id: 1282970491. Report id: 4111461
     
  13. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Thank you for the Build and Report ID information. It appears the build could not complete due to insufficient memory resources while attempting to compile the FileInfo module for PHP 5.3:
    Code:
    virtual memory exhausted: Cannot allocate memory
    make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
    !! 'make' failed with exit code '512' !!
    Please access the Exhaustive Options List in EasyApache and deselect, that is, disable, the FileInfo option for PHP 5.3. The FileInfo PHP module requires an unusually large amount of available memory (RAM) resources in order to compile successfully.

    Please also ensure to remove any customizations from the Apache/httpd configuration:
     
  14. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    thanks now the build complete

    some of threads on google
    said the problem it could be form
    # Mod Security
    is that true
     
  15. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    It is possibile for a mod_security rule to look for specific criteria and subsequently force a specific HTTP status code (such as 404: Not Found); however, if you're able to access the same mod_userdir URL directly I would then believe that the issue may stem from the specific redirect configuration of mod_rewrite entries in the applicable Apache .htaccess file(s).

    If it is related to mod_security I recommend searching its audit log; this can be performed using WebHost Manager via the following menu path: WHM: Main >> Plugins >> Mod Security

    The mod_security audit log can be monitored for new entries via root SSH/console access, and may be found at one of the following paths:
    Code:
    /usr/local/apache/logs/modsec_audit.log
    /usr/local/apache/logs/audit_log
    Here are two example commands for the above log paths:
    Code:
    # tail -fvn0 /usr/local/apache/logs/modsec_audit.log
    # tail -fvn0 /usr/local/apache/logs/audit_log
     
  16. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I did up data the Apache with out the mod securty
    but the problem still exists

    i sent to host my problem "waiting for there replay "
     
  17. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    they just sent me alot of msg

    1
    You have full root access to your server. Please check your configurations and server logs for more information about this problem.

    2

    Hello.

    'mod_rewrite' is already installed for your Apache server.

    3
    Hello.

    We cannot debug your code, please check 'mod_rewrite' documentation.

    what's that

    4
    Hello,

    you will need to check apache documentation for mod_rewrite.
    5
    Hello.

    We have already give you all needed information.
     
  18. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
  19. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    If cPanel was not yet used to setup any of the desired redirects, please rename or move the existing Apache .htaccess file(s) out of the way to start over, then setup ("from scratch") the desired redirects using cPanel via the following menu path (with linked documentation): cPanel: Main >> Domains >> Redirects
     
  20. mms

    mms Member

    Joined:
    Aug 26, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Thanks alot cPanelDon you wear cooperative with me
    it's working now by adding
    RewriteBase /~ll22ll/upload
     
Loading...

Share This Page