Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7685033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:09:48+00:00 2026-05-31T19:09:48+00:00

I have my site as localhost/tutorials/rewrite/news.php on this page are titles from news articles

  • 0

I have my site as localhost/tutorials/rewrite/news.php on this page are titles from news articles that are in my database. Each title is a link to read the article. The link is

'<a href="read-news.php?url=' . $url . '">' . $title1. '</a>'

The read-news.php page gets the url and uses it in an sql statement to get the article from the database

$url = $_GET['url'];
$sql = "SELECT * FROM news WHERE url = '$url'";

My link on the news.php page and the url on the read-news.php looks like this

localhost/tutorials/rewrite/read-news.php?url=the-news-today

How can i get it to look like

localhost/tutorials/rewrite/read-news/the-news-today.php

I have used the following htaccess code which by looking at other examples i thought should be enough to fix it

RewriteRule ^read-news/(.*).php /read-news.php?url=$1 [PT]

Any help please

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:09:49+00:00Added an answer on May 31, 2026 at 7:09 pm

    edit: your RewriteRule needs some work too. try this:

    RewriteRule ^read-news/(.*)\.php$ /read-news.php?url=$1 [PT]

    (you need to use a “$” to signal the end of your rewrite and escape the . before “php” with a backslash)

    Also, you should link to your pages how you want them displayed:

    href="localhost/tutorials/rewrite/read-news/the-news-today.php"

    The .htaccess won’t magically change the urls for you.

    Also if you want to be able to access your query string variables, i would add QSA to your flags: [PT,QSA]

    that way you can still access your url variable with $_GET['url'].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a route that is suppose to match something like this localhost:3000/site/admin and
I got this code from this site: http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx But I'm just a beginner so
For example I have site http://localhost/site In IIS I set that 404 error causes
I have just setup a new local site (localhost/pfb.net/) which has been cloned from
I have strings like this: http://localhost:2055/web-site-2009/paginas/noticias/**IGP-M recua 0,36% em agosto, aponta FGV**-46.aspx I'd like
I have a site on my localhost that i am using session variables on.
I'm using the source code found on this site here: http://webtint.net/tutorials/5-star-rating-system-in-php-mysql-and-jquery/comment-page-1/#comment-2562 A fantastic resource,
I have a site with a page that contains some tabs and when selecting
I have a WordPress site (on my localhost) that uses a <ul> for a
I have this error on IIS but on localhost site work's good. Could not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.