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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:00:33+00:00 2026-06-11T03:00:33+00:00

I have a PHP website site that uses GET variables to determine what it

  • 0

I have a PHP website site that uses GET variables to determine what it should be doing…

eg /index.php?s=about&p=2

It seems that I should be able to change this using rewrite rules so I could use URLs like:

/about/2

How can I get that behaviour?

  • 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-06-11T03:00:35+00:00Added an answer on June 11, 2026 at 3:00 am
    1. You need to change all of your links to look like /about/2.
    2. You need to adjust any relative links to be either absolute links or add this to the header of all your pages:

      <base href="/">
      
    3. Add these rules to the htaccess file in your document root to change the nice looking links back to the ugly links:

      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^([^/]+)/([^/]+)/? /index.php?s=$1&p=$2 [L]
      
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^([^/]+)/? /index.php?s=$1 [L]
      
    4. Just so search engines can re-index your pages, you need to 301 redirect the old ugly ones to the nice looking ones by adding this to the same htaccess file:

      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?s=([^&]+)&p=([^&]+)
      RewriteRule ^index.php$ /%1/%2 [L,R=301]
      
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?s=([^&]+)
      RewriteRule ^index.php$ /%1 [L,R=301]
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a school project regarding a small website that uses php. I
I'm developing a PHP website that uses url routing. I'd like the site to
I have a PHP based website that uses coupon codes. I can restrict search
Thanks for reading my question. I have a website that uses PHP for a
I have a php script that grabs links from another website. I am storing
I have a web site that runs on Windows and uses cp1252 (aka Win-1252
I built a really basic php/mysql site for an architect that uses one 'projects'
I have a classifieds website, which uses PHP and MYSQL. I have several pages
I have a one page site that has PHP code in it. Once the
I have a Java application that I need to integrate our existing PHP website

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.