+ Reply to Thread
Results 1 to 5 of 5
Like Tree2Likes
  • 1 Post By adamr_carter96
  • 1 Post By adamr_carter96

Thread: htaccess mod rewrite

  1. #1
    adamr_carter96 is offline x10Hosting Member adamr_carter96 is an unknown quantity at this point
    Join Date
    Sep 2011
    Posts
    5

    htaccess mod rewrite

    Hi all.

    I've been here for a little while now, and have started using htaccess.

    I'm trying to remove a get parameter from the url, and make it look like a subpage.

    User types "mydomain.com/page"
    But the page loaded is "mydomain.com/index.php?q=page"

    I know this can be done using htaccess, there is alot of stuff on the web about it.

    I've tried many things, but nothing seems to work.

    I wondered whether mod_rewrite was enabled, but there are endless posts asking this, with answers saying it is.

    Could it be because we have litespeed servers?

    Thanks in advance for your help.

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: htaccess mod rewrite

    It is enabled. It does work.

    If you post your .htaccess, we can perhaps help.
    Nothing is always absolutely so.

  3. #3
    adamr_carter96 is offline x10Hosting Member adamr_carter96 is an unknown quantity at this point
    Join Date
    Sep 2011
    Posts
    5

    Re: htaccess mod rewrite

    Thanks.

    Here's the offending bit;

    Code:
    RewriteEngine On
    
    
    Options +FollowSymlinks
    
    
    RewriteRule ^home/([.]+) http://adams-site.x10.mx/home.php?page=$1 [NC]

    When I try going to "http://adams-site.x10.mx/home/something, I get the 404 error page.

    Thanks again.
    karimirt47 likes this.

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: htaccess mod rewrite

    RewriteRule ^home/([.]+) http://adams-site.x10.mx/home.php?page=$1 [NC]

    means "one or more periods"

    A period "." inside [ ] looses its special meaning of "any character"

    Try

    RewriteRule ^home/(.+) http://adams-site.x10.mx/home.php?page=$1 [NC]

    Also, do you really want them to request the page again? That is what you are doing. If not, try

    RewriteRule ^home/(.+) home.php?page=$1 [NC]
    Last edited by descalzo; 11-21-2011 at 01:32 PM.
    Nothing is always absolutely so.

  5. #5
    adamr_carter96 is offline x10Hosting Member adamr_carter96 is an unknown quantity at this point
    Join Date
    Sep 2011
    Posts
    5

    Re: htaccess mod rewrite

    Thanks for that!

    It works perfectly (apart from a .php on the end, but I can sort that myself)

    Thanks again, acarter96.
    dinomirt96 likes this.

+ Reply to Thread

Similar Threads

  1. .htaccess rewrite php
    By shaistar in forum Programming Help
    Replies: 4
    Last Post: 06-21-2011, 10:40 AM
  2. .htaccess MOD REWRITE
    By DarkDragonLord in forum The Marketplace
    Replies: 6
    Last Post: 04-26-2011, 02:07 AM
  3. problem with rewrite in htaccess
    By julien.monnier91 in forum Free Hosting
    Replies: 3
    Last Post: 12-10-2010, 05:49 PM
  4. Htaccess url rewrite
    By cartermcpyro in forum Free Hosting
    Replies: 0
    Last Post: 03-06-2010, 10:01 AM
  5. Need help with Htaccess mod-rewrite
    By Mumin in forum Programming Help
    Replies: 2
    Last Post: 06-23-2008, 04:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers