Closed Thread
Results 1 to 2 of 2

Thread: .htaccess confusion

  1. #1
    shaistar's Avatar
    shaistar is offline x10Hosting Member shaistar is an unknown quantity at this point
    Join Date
    Jun 2011
    Location
    Florida
    Posts
    23

    Exclamation .htaccess confusion

    Ok so I've been spending a couple of days trying to make seo friendly urls.

    This is what my .htaccess file looks like now.

    <IfModule mod_rewrite.c>

    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /

    RewriteRule ^category index.php

    RewriteCond %{HTTP_HOST} ^example\.co.cc$ [NC]
    RewriteRule ^(.*)$ http://www.example.co.cc/$1 [R=301]


    </IfModule>

    I've tried rules upon rules in different combinations from all over the internet. I tried testing it on my home testing server and I tried uploading thru ftp onto my free account. None of the rules that i tried work at all on either one except the second one. I went to corz.org dude, I read the Apache manual, and I searched the forms... nada. I even copied and pasted to make sure I didn't mess up and insert the data that applied to my website.

    I want my url to look like this
    http://www.confused.co.cc/example/something-else

    My php dynamic urls look like this now:
    http://www.confused.co.cc/index.php?...something-else

    If anybody could lend a helping hand it will be greatly appreciated.
    hello?

    If it helps I have an index.php file with a script to include files. If it matters...
    Last edited by shaistar; 06-23-2011 at 02:24 PM.

  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,635

    Re: .htaccess confusion

    Step 1: Turn the engine on and set the base (especially where you have virtual hosts)


    Code:
    RewriteEngine on
    RewriteBase /

    Step 2: Make sure that the request isn't for a file or directory:

    Code:
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    The !-f means not a file and !-d means not a directory


    Step 3. Change foo/bar into index.php?section=foo&page=bar

    Code:
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.+)/(.+) index.php?section=$1&page=$2 [L]
    . = any character
    .+ = 1 or more of any character
    (.+) = group answer for later reference as $1
    (.+)/(.+) = captures front and back strings into $1 and $2
    Nothing is always absolutely so.

Closed Thread

Similar Threads

  1. Replies: 5
    Last Post: 04-18-2011, 07:52 AM
  2. Help with all this confusion...
    By emkweb in forum Free Hosting
    Replies: 5
    Last Post: 02-10-2011, 11:27 PM
  3. ftp confusion
    By midgardtree in forum Free Hosting
    Replies: 3
    Last Post: 01-23-2010, 01:16 PM
  4. PhP confusion
    By tanya in forum Free Hosting
    Replies: 2
    Last Post: 10-05-2007, 12:28 PM
  5. confusion
    By roddick in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 07-27-2005, 02:24 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