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.

Apache 2.2 rewrite and .htaccess

Discussion in 'EasyApache' started by helper, Oct 11, 2007.

  1. helper

    helper Member

    Joined:
    Sep 27, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Been through hundreds of threads (here and on the web)!

    First off, WHM 11.11.0 cPanel 11.15.0-C17588 running on RHES5 with Apache 2.2/PHP5.2.4

    Apache:
    Code:
    [root@server ~]# httpd -l
    Compiled in modules:
      core.c
      mod_authn_file.c
      mod_authn_default.c
      mod_authz_host.c
      mod_authz_groupfile.c
      mod_authz_user.c
      mod_authz_default.c
      mod_auth_basic.c
      mod_include.c
      mod_filter.c
      mod_log_config.c
      mod_logio.c
      mod_env.c
      mod_expires.c
      mod_headers.c
      mod_unique_id.c
      mod_setenvif.c
      mod_proxy.c
      mod_proxy_connect.c
      mod_proxy_ftp.c
      mod_proxy_http.c
      mod_proxy_ajp.c
      mod_proxy_balancer.c
      mod_ssl.c
      prefork.c
      http_core.c
      mod_mime.c
      mod_status.c
      mod_autoindex.c
      mod_asis.c
      mod_suexec.c
      mod_cgi.c
      mod_negotiation.c
      mod_dir.c
      mod_actions.c
      mod_userdir.c
      mod_alias.c
      mod_rewrite.c
      mod_so.c
    
    mod_rewrite does appear to be loaded, however, when I attempt to set the following rewrite conditions in a site (.../public_html/.htaccess):
    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule index/(.*)/(.*)/$ /index.php?$1=$2
    After the addition to the .htaccess file, restarted Apache (just for safe measure), and guess what... NADA -- this simple rewrite rule is NOT working.

    Any suggestions? Is there something in the WHM that blocks the ability for .htaccess for individual sites? Help!
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Nothing in any error logs?
     
  3. helper

    helper Member

    Joined:
    Sep 27, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Nope, nothing at all -- it's like .htaccess is totally unavailable! The page navigates fine, but without the rewrite rule it shows the query string.
     
  4. helper

    helper Member

    Joined:
    Sep 27, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    This does work if I enter a URL: http://[mysite]/Google

    Code:
    RewriteRule Google http://www.google.com/? [NC,R,L]
     
  5. helper

    helper Member

    Joined:
    Sep 27, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Solution:

    Code:
    RewriteCond %{QUERY_STRING} ^(.*&)?page=([^&]+)(&.*)?$ [NC]
    RewriteRule ^index\.php$ /tpb/%2? [R,L]
    Seems that Apache 2.2 needs to see the query string and have those extra codes at the end of the RewriteRule
     
Loading...

Share This Page