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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:05:49+00:00 2026-06-06T10:05:49+00:00

At the moment using .htaccess in my PHP Application to choose which page I’m

  • 0

At the moment using .htaccess in my PHP Application to choose which page I’m rendering, so for example if the URL is url.com/register, it is actually url.com/index.php?page=register and it gets the content of /Theme/register.html.

Here it is:

RewriteEngine On
RewriteRule ^(|/)$ index.php?page=$1
RewriteRule ^([a-zA-Z0-9/_-]+)(|)$ index.php?page=$1
RewriteRule ^(.*)\.htm$ $1.php [NC]

Thing is, I am not happy with this since if I want to use another GET parameter I’d lose this ‘pretty url’. I have seen other frameworks that do it without the need of Mod rewrite and I’d like it if someone could give me a simple and/or proper example of how to do it, or explain it.

Thanks!

  • 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-06T10:05:50+00:00Added an answer on June 6, 2026 at 10:05 am

    The usual approach is to redirect everything* towards the main boostrap file of your application usually index.php.

    • When i say everything i mean every URL that is not a file or directory within your public filesystem.

    In that way PHP gets the delightful job of parsing the URL and figuring out (dynamically) what page should be rendered and what parameters have been passed.

    That’s where MVC routers come into place, they have the task of braking the URL into segments and figuring out which of the segments indicate that you should be using a certain controller, which of the segments indicate that the controller should be calling a certain method and which of the segments are parameters that should be passed to the method call.

    This approach is used in WordPress for example and the URL parsing is done according to a URL structure you can specify in the admin.

    It is also used by CakePHP an MVC framework that allows defaults to the following URL structure: controller_name/method_name/parameter_1:value_1/parameter_2:value_2/. But can be customized to any extent such as defining a RegEx that extracts the parameters from the URL.

    The code bellow is the default .htaccess that WordPress generates.

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.php$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
    </IfModule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a module at this moment using which we are planning
I'm at the moment using the PHP money_format() function , and have money_format('%.0i', $row['price'])
I need to issue a redirect, using .htaccess, to a URL with a fragment
I'm developing an iPhone app at the moment using Appcelerator Titanium which has 3
I am doing some screen scraping work at the moment using PHP and Simple
I'm using the standard Zend /public/.htaccess file (shown below). At the moment I'm attempting
At the moment I'm using Apache's mod_rewrite to redirect all html requests to http(s)://www.domain.com/blah
At the moment am using JOGL for a ball detection program I have been
At the moment I'm using bat file to launch my jar and set the
At the moment I'm using all sorts of if statements and substrings in order

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.