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 7417647
In Process

The Archive Base Latest Questions

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

If you go to a url like the following: http://stackoverflow.com/questions/9155602/ the address bar will

  • 0

If you go to a url like the following: http://stackoverflow.com/questions/9155602/ the address bar will be updated to http://stackoverflow.com/questions/9155602/redirect-existing-file-to-different-url-using-mod-rewrite. This is not done with JavaScript and not with a hard-refresh, my best guess is that it’s done with mod_rewrite; however, how would it know the title of the article without server side processing with php?

I just updated my site to use SEO friendly url’s, it used to be /shows.php?id=review-1 and now it’s /review/1/super-baseball-2020. The text at the end doesn’t actually really matter when it comes to my rewrite which is:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9]+)/([0-9]+)/([a-z0-9-]+)?/?$ /shows.php?id=$1-$2 [L,NC]

My current path of making sure Google doesn’t hit me for duplicate content, and that bookmarks get forwarded properly is the following:

RewriteCond %{THE_REQUEST} ^GET\s/shows\.php\?
RewriteCond %{QUERY_STRING} (?:^|&)id=review-1(?:&|$) [NC]
RewriteRule ^ /review/1/super-baseball-2020/? [R=301,L,NC]
RewriteCond %{THE_REQUEST} ^GET\s/shows\.php\?
RewriteCond %{QUERY_STRING} (?:^|&)id=review-2(?:&|$) [NC]
RewriteRule ^ /review/2/aero-fighters-2/? [R=301,L,NC]
RewriteCond %{THE_REQUEST} ^GET\s/shows\.php\?
RewriteCond %{QUERY_STRING} (?:^|&)id=review-3(?:&|$) [NC]
RewriteRule ^ /review/3/aero-fighters-3/? [R=301,L,NC]
.... and so on ....

That solution is very shortsighted and is thousands of lines to put into my .htaccess.

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

    how would it know the title of the article without server side
    processing with php?

    mod_rewrite can only do so much. Plus, you’d have to update it too much. It’s best to handle these requests with scripting. Create an .htaccess, similar to what you’ve done:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /index.php [QSA,L]
    </IfModule>
    

    Then in your index.php, split the REQUEST_URI to parse out the /review/1/, look in the database for the title of the review with id of 1, pass it to your friendly URI (slug) function, and append it to the url, then redirect.

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

Sidebar

Related Questions

Please see the following link structure http://stackoverflow.com/questions/10672712/voting-system-like-stackoverflow In the above link the 10672712 is
I'd like to transform an URL like this http://www.mydomain.com/it/archive.php=321123 in one like the following
I would like to build the following url for artcles: http://mysite.com/articles/ ID . Where
I have a URL that is like the following: http://www.example.com/client/project/subdirectory/value/ I would like like
I would like to develop URL's which look like the following: http://mysite.com/products/1/best-product-in-the-world Where all
In my web application I have a url that looks like the following: http://mydomain.com/search/index/list/for-sale/london/0/0/0/0
I am using an URL like the following: https://www.google.com/accounts/OAuthAuthorizeToken? oauth_token=ab3cd9j4ks73hf7g&oauth_callback=http%3A%2F%2Fwww.example.com This gets redirected to:
Its my understanding that the questions in StackOverflow has the following format http://stackoverflow.com/questions/{question-id}/{slug-made-from-question-title} So
I want to rewrite a URL like: http://domainname.com/all-studio-methods To: http://domainname.com/review.php?id=25&cas=all-studio-methods My .htaccess file currently
I have a url like the following: http://www.example.com/cat/دسته/page/2/ As you can see there is

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.