Results 1 to 7 of 7
  1. #1
    Full Member dak142's Avatar
    Join Date
    January 18th, 2005
    Posts
    386
    I have a question, maybe what I was thinking would happen is not supposed to happen. When you rewite a url, can you see it in the address bar with IE?

    I added the below code to my root directory, and name the file .htaccess. However, when I view the site nothing looks different. Should it look different or does it only look different to the spiders? I just learned of Mod_rewrite yesterday and I can see there is alot to learn. Just want to make sure I am on the right path.



    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule dentalplans/(.*)/(.*)/$ /dentalplans.php?$1=$2

  2. #2
    I like traffic lights
    Join Date
    January 18th, 2005
    Location
    Southern hemisphere - away from Fukushima
    Posts
    2,936
    You're better off putting it inside your http.conf file, withint the virrtualhost container for the appropriate domain name.

  3. #3
    Full Member dak142's Avatar
    Join Date
    January 18th, 2005
    Posts
    386
    I would but unfortunately my host does not give me access to http.conf

  4. #4
    Full Member dak142's Avatar
    Join Date
    January 18th, 2005
    Posts
    386
    This is the current URL

    http://www.mysite.com/dentalplans.ph...smetic-Dentist

    ------------------------------------------------------------------------------------
    This is how I want it to look to make it SE friendly.

    http://www.mysite.com/dentalplans/Fl...ic-Dentist.php


    ------------------------------------------------------------------------------------

    This is my .htaccess file on the root of my site and it was also put in the conf file. It does nothing at all, is my synatx correct?

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule dentalplans/(.*)/(.*)/$ /dentalplans.php?$1=$2

  5. #5
    ABW Ambassador
    Join Date
    January 17th, 2005
    Posts
    530
    I don't think it will work the way you are
    doing it. First you would need to make some
    changes in your php script to print the url
    on your pages the way you want the search
    engines to see them. So instead of showing the
    first link on your pages it would show the
    second link.
    Then you would use something like this in
    your .htaccess:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^dentalplans\/(*).php$ dentalplans.php?key=$1

  6. #6
    Newby Apologist
    Join Date
    January 18th, 2005
    Posts
    46
    To rewrite /dentalplans/Florida-Cosmetic-Dentist.php to /dentalplans.php?key=Florida-Cosmetic-Dentist, try this:

    RewriteRule dentalplans/(.*)\.php$ dentalplans.php?key=$1

    The first expression -- dentalplans/(.*)\.php$ -- describes the URL that you're expecting the user (or spider) to visit. The second expression -- /dentalplans.php?key=$1 -- is the actual URL of the page/script.

    This doesn't change anything about the existing site -- you'll want to manually change your links to point to the new, static-appearing URLs. Redirecting users from the dynamic URLs to the static URLs with mod_rewrite gets trickier, and is probably more easily done within your PHP script. But really there's little need to do this once you've updated your links.

    -Dave

  7. #7
    Full Member dak142's Avatar
    Join Date
    January 18th, 2005
    Posts
    386
    Ok, Now I think I see where I was confused!

    The idea is to write your links the way you want them in the first place, and then, rewrite them internally so the server knows what they are! If that is where I was going wrong than this should be a little easier. The smallest misunderstanding make things so difficult.

  8. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. .htaccess question
    By DealSucker in forum Programming / Datafeeds / Tools
    Replies: 1
    Last Post: November 7th, 2012, 03:50 PM
  2. .htaccess question
    By Convergence in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: April 2nd, 2009, 08:53 PM
  3. .htaccess question
    By Wayder in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: December 20th, 2005, 04:24 PM
  4. Mod_Rewrite Question
    By MrSpeed in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: February 25th, 2004, 07:51 PM
  5. .htaccess and mod_rewrite problem
    By c4 in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: December 3rd, 2002, 05:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •