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.

Results 1 to 9 of 9
  1. #1
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times

    What is the best way to learn to use URL rewrite using php and MySQL?

    I want it to read the database for an article and have a field with the new url.

    Where can I read a step by step way to do this?

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    It depends on how your articles are currently stored in the database. Does each article have a title? Or does each article have an ID number? Give us an example of how you currently read an article.


  4. #3
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    It has an ID number. Everything in any of my databases have IDs. They have titles but I'd like to create a field that has the new url.

  5. #4
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    As of right now, here are the fields I have.

    id
    catid
    title
    subTitle
    linkTitle
    pageName
    body
    dateStarted
    dateUpdated
    ordering
    published
    metaWords
    metaDescription
    notes

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    So at the current time, when you wish to read one article, how do you enter the URL now?
    Sort of like this? mysite.com/?article=123


  7. #6
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    I'd like to add the field newUrl

  8. #7
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    Quote Originally Posted by mlseim View Post
    So at the current time, when you wish to read one article, how do you enter the URL now?
    Sort of like this? mysite.com/?article=123
    Yes, exactly

  9. #8
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    ok, I have read a lot and have made some changes.

    I currently have mysite.com/?artid=92
    I'd like it to be mysite.com/article-name
    where "article-name" is a field in the article id 92

    I have in my .htaccess:
    RewriteEngine On
    RewriteRule ^(.*)$ /index.php?artid=$1


    I have been told to set $newUrl = $_GET['newUrl']; ?

    how does this work when I do not have a newUrl set in the address bar?

    Currently, if I type mysite.com/bunchofstuff-here it will load my home page, which tells me that I have done something right so far.

  10. #9
    Junior Member johannawilliams's Avatar
    Join Date
    Aug 2013
    Location
    New York
    Posts
    4
    Member #
    37087
    This is implemented in a different manner for each website. It really depends on what you have used to make your website. What I mean to say is: Please state whether you have used core PHP or some Open source CMS to make your website?


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 08:40 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com