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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:27:37+00:00 2026-06-17T15:27:37+00:00

I previously changed my .htaccess file so that my ‘subdirectory’ (13/) can be the

  • 0

I previously changed my .htaccess file so that my ‘subdirectory’ (13/) can be the ‘directory’ I use for my main domain by adding :

RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ 13/index.php [L]

Now I want to remove the .php extensions and extensions like index.php?eventid=3 to index/something

EDIT#1[where something is the name of that id stored in the database]

How should I do that?
Previously, I did work in some PHP-frameworks but they already have a dedicated url file. So I never thought much about it. But this time, I’m not using any framework, so I need to modify .htaccess.

I looked around, but was unable to find any reliable blog/sources.

EDIT #2

My sub-directory is public_html/13/.

ie, www.mydomain.com redirects to www.mydomain.com/13/
Now I want to access www.mydomain.com/13/events.php?eventid=1 as www.mydomain.com/events/44

  • 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-17T15:27:39+00:00Added an answer on June 17, 2026 at 3:27 pm
    RewriteRule ^([A-Za-z0-9\-]+)/([A-Za-z0-9\-]+)/([0-9]+)/?$ $1.php?$2=$3
    

    The above code would redirect http://www.mydomain.com/index/eventid/3/ to http://www.mydomain.com/index.php?eventid=3

    htaccess is very flexible, and creating variations of the above is pretty easy once you understand the syntax. You will want to read up on the regular expressions you can use, and the myriad of options the Rewrite module has to offer. Most of my redirects look like the above though, real simple.

    EDIT: An example of what you’re looking for is WordPress, which uses slugs to identify pages based on something more semantic than an ID number. You would have to url encode the name of the item from the database and either store it in the database as the slug, or find some other way of making it usuable in the database query that retrieves the content of the page. Then your htaccess would look something like this:

    RewriteRule ^([A-Za-z0-9\-]+)/([A-Za-z0-9\-]+)/?$ $1.php?slug=$2
    

    In your PHP you will need to create slugs and store them in the db so they can be used as IDs in your queries.

    EDIT2: Try changing your entire htaccess file to just this:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
    
    RewriteRule ^([A-Za-z0-9\-]+)/([A-Za-z0-9\-]+)/([0-9]+)/?$ $1.php?$2=$3
    
    </IfModule>
    

    I have tested it and it works. Something else in your htaccess is messing it up.

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

Sidebar

Related Questions

I have a PHP MSSQL Query that worked previously, Hoever since I have changed
I'm looking to set rules in my .htaccess file so that all files with
UPDATE: I've changed the wording of the question. Previously it was a yes/no question
I've got a int, that is changed in a previous method, that now has
I have a htaccess rule that is fixing some of my previous URL change
I wanted a clickable TextView that changes color and holds it, that changes previously
I asked a question about this previously but my database structure has changed, and
I have an object that I created previously. obj = new Object(); I would
Followed the instructions here and recreated certificates that I previously incorrectly created. Something has
I'm new to BookSleeve and it seems that the API has changed even when

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.