Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 22
  1. #1
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    I tried looking at documentation on the mod_rewrite forums but this stuff is like chinese to me!

    I'm trying to change my links from

    http://www.karinne.net/archive/?bid=9

    to something like

    http://www.karinne.net/archive/make-your-html-efficient/

    where "make-your-html-efficient" is the title of my article.

    I don't even know where to start ... what to put in my .htaccess file. How are my link going to look like now?

    Help!?
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us

  2.  

  3. #2
    Senior Member -chris-'s Avatar
    Join Date
    Apr 2006
    Location
    SK
    Posts
    1,205
    Member #
    13102
    What blog platform are you using? I know that in WordPress there is a place to choose how your links look. I would actually have to find it if you are using WP.
    Portfolio | Blog | Twitter

    Was my post, or someone elses, helpful? Click the thumbs up to let everyone know!

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    You can't use mod_rewrite that way without a SEF database solution.

    What you CAN do is use mod_rewrite to change URLs like this:

    /archive/make-your-html-efficient_bid9
    to this:

    /archive/?bid=9
    Your .htaccess file would look something like this (not tested):

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*\/archive\/.*_bid([0-9]*).* /archive/?bid=$1
    And you'd have to modify your code to generate links by formatting the title lowercase with dashes followed by "_bid" . $bid

  5. #4
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    Ok ... that makes sense.

    So ... my links in my HTML would look like

    HTML Code:
    <a href="/archive/make-your-html-efficient_bid9">bla bla bla</a>
    can they have a .html extension?
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us

  6. #5
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    Ah ... I just notice -chris- replied too ... sorry! :classic:

    Quote Originally Posted by -chris-
    What blog platform are you using? I know that in WordPress there is a place to choose how your links look. I would actually have to find it if you are using WP.
    Thanks for the reply Chris but I don't use WP ... I have a custom built system.
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us

  7. #6
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Quote Originally Posted by karinne
    Ok ... that makes sense.

    So ... my links in my HTML would look like

    HTML Code:
    <a href="/archive/make-your-html-efficient_bid9">bla bla bla</a>
    can they have a .html extension?
    Exactly. Yes, you can put any extension you want.

  8. #7
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Note: I modded my RewriteRule in the .htaccess code above... I had accidentally inserted a line break in it.

  9. #8
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    Alright ... I'll try that out this week.

    Thanks Steven. I'll let you know if I have problems
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us

  10. #9
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    One more question before I try this out :nervous:

    This part here

    Code:
    RewriteRule ^.*\/archive\/.*_bid([0-9]*).* /archive/?bid=$1
    can I change that too [minicode][0-1000][/minicode]? Because that number is basically the id of the article in the db so ... depending on how many article I put in there....

    Thanks
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us

  11. #10
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    [0-9]* means match any number, period (even technically an empty string, so it should really be [0-9]+). It's not the same thing as matching any single digit number from 0 to 9.

    Regexs aren't the most intuitive things in the world, but they're extraordinarily powerful.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


Page 1 of 3 1 2 3 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:55 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com