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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:15:58+00:00 2026-06-11T23:15:58+00:00

I am trying to use mod_rewrite to keep only the query string in a

  • 0

I am trying to use mod_rewrite to keep only the query string in a url, and remove index.php?p=.

For example, this link

http://domain.com/index.php?p=page-name-with-dashes

Into

http://domain.com/page-name-with-dashes.html

All pages are loaded through the control script index.php and the query p=name, like this

<?php
$page = isset($_GET['p']) ? $_GET['p'] : 'home';
...
require_once 'content-' . $page . '.php';
...
?>

I have tried all variants below, but none works – some give 404 some give 500 errors.

#RewriteRule ^index.php?p=(.*) $1/

#RewriteRule ^([^/]+)/?$ /index.php?p=$1 [QSA,L]

#RewriteRule ^(.*)$ index.php?p=$1 [NC,L,QSA]

What am I doing wrong? I don’t know much about htaccess rules, so forgive my newbie question.

  • 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-11T23:15:59+00:00Added an answer on June 11, 2026 at 11:15 pm

    Try this:

    RewriteRule ^(.*).html$  index.php?p=$1 [L]
    

    But be aware that if you have multiple cases (for example some other type of url to rewrite) be careful with ordering of RewriteRules because you could easily override one with another…

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

Sidebar

Related Questions

Hey, I am trying to use mod_rewrite to make http://example.com/style/universal.css show the page http://example.com/style.php?n=universal
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am need paint my image. I'm trying use JQuery in here this link:
I'm trying to use mod_rewrite to achieve the following rewrite: From - http:// pre.domain.com/public/?project=Awesome
I use mod_rewrite/.htaccess for pretty URLs. I forward all the requests to my index.php,
I'm trying to use mod_rewrite to redirect URLs from a URL from an old
I'm trying to work with mod_rewrite without particular problems but this: RewriteRule ^(product/)([^/\<\>].+?)(/)([^/\<\>].+?)(/edit)/?$ php/prd_edit.php
I want to rewrite an url like this: http://www.piata-bio.ro/presa-bio.php?var1=http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNHmU7U7bXtlH9Lo8dXfBs64PqxgbA&url=http://www.eva.ro/divertisment/stiri/un-nou-concept-de-magazin-articol-35491.html to something like this :
I'm trying to use mod_rewrite to handle an unknown number of variables. An example
I'm trying to use mod_rewrite to pass a full unescaped URL as a parameter,

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.