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

  • Home
  • SEARCH
  • 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 7418047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:48:44+00:00 2026-05-29T07:48:44+00:00

I want to apply the page HTML title in the URL for example in

  • 0

I want to apply the page HTML title in the URL

for example in here (stackoverflow) the url is something like that:

http://stackoverflow.com/questions/10000000/get-the-title-of-a-page-url

you can see the “get-the-title-of-a-page-url” part which is the page title

what i mean is when the user go to spowpost.php?post=1

the actual url that shows up when the pages load will be
spowpost.php?post=1$title=..the_title..

how can i do that?

EDIT: i was thinking about htaccess , but i don’t know this very well so tutorial would help for this CERTAIN case..

  • 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-29T07:48:45+00:00Added an answer on May 29, 2026 at 7:48 am

    You can use .htaccess for this. For example:

    RewriteEngine On
    RewriteRule ^questions/(\d+)/([a-z-]+) index.php?id=$1&title=$2 [L]
    

    Your PHP page (index.php) receives the id and title as parameters in $_GET[]:

    echo $_GET['title'];
    // get-the-title-of-a-page-url
    

    You can then use that (or the id, which is easier) to retrieve the correct item from your data source:

    // Assuming you didn't store the - in the database, replace them with spaces
    $real_title = str_replace("-", " ", $_GET['title']);
    $real_title = mysql_real_escape_string($real_title);
    
    // Query it with something like
    SELECT * FROM tbl WHERE LOWER(title) = '$real_title';
    

    Assuming you do have an id parameter in the URL of some sort, it’s easier to query based on that value. The title portion can be used really only to make a readable URL, without needing to act on it in PHP.

    In reverse, to convert the title to the format-like-this-to-use-in-urls, do:

    $url_title = strtolower(str_replace(' ', '-', $original_title));
    

    The above assumes your titles don’t include any characters that are illegal in a URL…

    $article_link = "http://example.com/spowpost.php?post=$postid&$title=$url_title";
    

    Or to feed to .htaccess:

    $article_link = "http://example.com/spowpost$postid/$url_title";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have some HTML page, and a corresponding CSS file. I'd like
I want to apply some CSS to text that I can't get marked up
I have an html page with divs that have id (s) of the form
I want to use a function on my html page but the content is
I don't know how to apply CSS for a HTML generic control like <UL>
So I have a page I want to apply some CSS to, but it
i am calling iframe on html page within it i have website url, i
Here is my code: How can I apply a class for the current page
I have the following CSS that I can apply to an HTML input tag.
I have a page that looks like: <div id=header>...</div><div id=navigation>...</div> similar for body and

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.