Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
additional .htaccess in subfolder | mod_rewrite for query parameter

I have a little mod_rewrite problem and really need some help.

I need to have a second .htaccess file in a subfolder for a project on my domain.

The URL to the project is like:

https://example.com/project-name/

Now I have a query parameter for which I want to create a nice URL with mod_rewrite.

The URL including the parameter looks like this:

https://example.com/project-name/index.php?preset=nameofapreset

And I want it to be:

https://example.com/project-name/nameofapreset

The important thing: The mod_rewrite has to work for the current folder only. Without having any info about the current path, cause I need to use the file in other folders, too.

That's what I thought should work (cause I am using a similar rewrite rule in another project):

RewriteEngine On
RewriteRule ^([a-z])/?$ index.php?preset=$1

But it doesn't. And all my trials fail.

Any ideas how I can make it work?

Thanks!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use this rule in /project-name/.htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ index.php?preset=$1 [L,QSA]
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!