RewriteRule for exact folder name with htaccess - .htaccess

Please help me on the RewriteRule below. I want to show the v3.php file for https://example.org/signup.
# Turn Rewrite Engine On
RewriteEngine on
# Rewrite for signup
RewriteRule ^signup v3.php [NC,L]
Works. But all other requests after /signup like /signups or https://example.org/signup/example/whatever show the v3.php as well. I need that RewriteRule only for that exact folder name.
Thanks for your help!

RewriteRule ^signup/?$ v3.php [NC,L]
Thank you, #anubhava

Related

rewrite all pages /en/XXX to /en

It's been a while since I've been busting my head to do a htaccess rewrite.
I would like to redirect all the pages from example.com/en/XXX to example.com/en.
I'm doing either redirection loops or errors 500.
Is it possible to help me to find the right formula?
I tried RewriteRule ^en/(.+)$ /en/ L,QSA
also this RewriteRule ^/en\/.*$ http://example.com/en/$1 [R=permanent,L]
Do you also know good links to learn htaccess and rewrite?
thank you in advance for your help
You need to put a condition to stop Looping, could you please try following once, base on your shown samples only.
RewriteEngine ON
RewriteCond %{REQUEST_URI} ^/en/.*/?$ [NC] [L]
RewriteRule ^(en)/.*$ http://example.com/$1 [NC,L]
Merci RaVinder pour ton aide ! <3

.htaccess rewrite URL with additional question mark “?”

With .htaccess i can't get working such link:
/quiz/results/solution-one/?email=myemail#domain.com
into
/results.php?level=4&email=myemail#domain.com
(solution-one should turn into level=4)
I have spend a few hours building .htaccess code:
Rewriterule ^quiz\/results\/solution-one/(.*)/?$ /var/www/domain.com/public_html/results.php?level=4$1 [QSA,L]
Or this one:
Rewriterule ^quiz\/results\/solution-one/([=#.a-zA-Z-]*) /var/www/domain.com/public_html/results.php?level=4&$1 [QSA,L]
But it doesn't work.
Thanks in advance!
Try with:
RewriteEngine on
Rewriterule ^quiz/results/solution-one/?$ results.php?level=4 [NC,QSA,L]
Without file path, but relative to root. And without test for query string (not part of Rewriterule test uri)

What is wrong htaccess

I have the following htaccess rules but I dont know how to make it work:
RewriteEngine on
RewriteRule ^game/([^/]*)$ index.php?cash=$1
The following is the screen shot of my folders structure:
Can someone tell me how to get it to work? I have also tried:
RewriteRule ^index.php([^/]*)$ index.php?cash=$1
The URL that I want to display is: http://localhost/biteep/game/100 while the URL that I want the browser to go to is http://localhost/biteep/game?cash=100
Try to put a rewrite base into your .htaccess:
RewriteBase /biteep/
And this route should be enough:
RewriteRule ^game\/(\d+)$ index.php?cash=$1
So it works when I do this
RewriteEngine on
RewriteRule ^([0-9]+)$ index.php?cash=$1

.htaccess change the URL page with three conditions

I want to change the url of my page like
http://localhost/Dynobase/my_computer.php?name=Deny-computer&type=computer&select=1
to
http://localhost/Dynobase/Deny-computer/computer/data/1
and to my htaccess file code like this
RewriteRule ^([a-zA-Z_-]+)/([a-zA-Z_-]+)/data/([[0-9]]+)$ /my_computer.php?name=$1&type=$2&select=$3 [L,NC]
but that I could actually error 404
maybe there is something wrong in my code.
please help me.
Thank you
Try this in /Dynobase/.htaccess:
RewriteEngine On
RewriteBase /Dynobase/
RewriteRule ^([\w-]+)/([\w-]+)/data/([0-9]+)/?$ my_computer.php?name=$1&type=$2&select=$3 [L,NC,QSA]

htaccess mods rewrite

Newby to htaccess mods , thankyou for any help
I'm tryin to rewrite the following into a more efficient solution
RewriteRule about http://www.website.co.uk/index.php?/page/about [NC,L]
RewriteRule testimonials http://www.website.co.uk/index.php?/page/testimonials [NC,L]
I want the user to enter
www.website.co.uk/page/about etc
Can anybody advise, have spent a couple of hours on this & getting nowhere fast!!
Thansks
If those are the only two pages you need to redirect use
RewriteRule (about|testimonials) /index.php?/page/$1 [NC,L]
If you want to serve all your pages like that use
RewriteRule ^page/(.*)$ /index.php?/page/$1 [NC,L]

Resources