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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:20:40+00:00 2026-05-12T07:20:40+00:00

For my site I have a RewriteRule that points the URL http://www.mysite.com/work to a

  • 0

For my site I have a RewriteRule that points the URL http://www.mysite.com/work to a work.php file. I also have a directory called “work” that has files in it, like project1.php, project2.php, etc…

What rules would I have to write so that the URL http://www.mysite.com/work knows to go to the work.php file, but the URL http://www.mysite.com/work/project1 knows I mean to go inside the directory “work” and display the project1.php file?

EDIT: Should point out, this is what I’m currently working with:

RewriteEngine On
RewriteBase /beta/
RewriteRule ^([a-z]+)$ $1.php [L]

Any additional tips to improve this security-wise? (Stopping directory jumping, etc…)

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

    Try this:

    RewriteEngin On
    RewriteBase /
    RewriteRule ^work$ /work.php [QSA,L]
    

    That will ensure that http://www.mysite.com/work (no trailing slash) will go to your work.php file.

    If you also want http://www.mysite.com/work/ (with trailing slash) to go work.php, add this line just above the last RewriteRule.

    RewriteRule ^work/$ /work [R=301,QSA,L]
    

    That will redirect it to the URL with no trailing slash thus, displaying the work.php file.

    UPDATE: Since you already have a RewriteBase directive, just put the RewriteRule line(s) right after your RewriteBase but before your RewriteRule as the rule you’re using a catch-all and will match everything.

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

Sidebar

Related Questions

Currently I have: RewriteCond %{HTTP_HOST} ^site\.com [NC] RewriteRule (.*) http://www.site.com/$1 [R=301,L] When I visit
We have a site I'll call example.com. Most of the time you see http://www.example.com
I have a site that needs to use mod_rewrite to direct traffic to www.example.com
In my live site I have php include() and require() that have full path
(1) I have a site that serves up MP3 files: http://domain/files/1234567890.mp3 (2) I have
I have the following .htaccess file which works fine for say www.companyone.com: RewriteEngine On
Say I have a site mysite.com, which is a wordpress site. I already have
I have two different domains (let's say www.site1.com and www.site2.com) that point to the
Ok so I have a site that needs to have 2 RewriteRules on it.
So I have site list on certain pages that basically just have links to

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.