I have a phycical folder at /shop/cart-plugins/subscription-wizard/. To make it easier for users find I have set up the following rule in my htaccess file to turn this into /join/.
It works great if they type in www.mywebsite.com/join/, but if they don't type in the last slash mark it doesn't do anything. I've looked all over google, but can't figure it out. Any advice you might have would be greatly appreciated.
Here's the rule I have set up.
RewriteRule ^shop/cart-plugins/subscription-wizard? /join/$1 [NC,R=301,L]
RewriteRule ^shop/cart-plugins/subscription-wizard/? /join/$1 [NC,R=301,L]
RewriteRule ^shop/cart-plugins/subscription-wizard/(.*) /join/$1 [NC,R=301,L]
RewriteRule ^join/(.*) /shop/cart-plugins/subscription-wizard/$1 [QSA]
Thanks...
RewriteRule ^join$ /join/ [L,R=301]
Related
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
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
I have been battling with the following code for ages and for some reason cannot redirect the following:
/folder/htdocs/uk/images/my-image.jpg >> /folder/htdocs/images/UK/my-image.jpg
I have tried
RewriteRule ^.+/(\w){2,3}/images/(.*)$ http://%{HTTP_HOST}/folder/htdocs/images/$1/$2 [NC,L]
RewriteRule ^/folder/htdocs/([A-Za-a]{2,3})/images/(.*)$ http://%{HTTP_HOST}/folder/htdocs/images/$1/$2 [NC,L]
And a number of variations but I still have not solved it. Please can someone advise how I can do this?
I have tried redirecting it to a file - just to capture the pattern matches but again to no avail.
Have this RewriteMap defined in your Apache server config (vhost):
RewriteMap uc int:toupper
Have this rule inside htdocs/.htaccess directory (create it if it doesn't exist):
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)/([a-z]{2})/images/(.+)$
RewriteRule ^ %1/images/${uc:%2}/%3 [L,NE,R=301]
Ok, im pretty new at this and I would really appreciate some help, thanks!
How can i rewrite this in .htaccess correctly?
So I have a query string in my url:
/?url=contact
All i want to do is remove the query string
/contact
Help? I scoured google and I'm learning the syntax right now, but the fact remains..I dont know how to do it just yet. Thanks to all
This was my solution:
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
Try this:
RewriteEngine On
RewriteRule ^(.*)$ /index.php?url=$1 [L]
To a user on your site, they will see and navigate to this:
http://example.com/contact
But the real page would be something like this:
http://example.com/index.php?url=contact
This bit, [L], tells the server that this is the last line of the rewrite rule and to stop.
RewriteCond %{QUERY_STRING} url=(.*)
RewriteRule index.html %1
(or whatever if it's not index.html, index.php, whatever)
You need to capture the query string, which is not looked at by RewriteRule normally, and use the %1 back reference, not $1 as you would in a capture in a RewriteRule
Before: https://example.com/index.php?user=robert
RewriteEngine On
RewriteRule ^user/([^/]+)?$ index.php?user=$1 [L,QSA]
After: https://example.com/user/robert
I have a domain at example.com
There is a subdirectory that has a quiz on it, located at example.com/quiz/?id=1
I need to change the ?id=1 to TakeTheQuiz so it would look like example.com/quiz/TakeTheQuiz
Here is what my .htaccess looks like right now (the .htaccess is located in the root direct at example.com). Right now I always get a server 500 error.
RewriteEngine On
RewriteBase /quiz
RewriteRule ^?id=1$ TaketheQuiz
This is really simple and all of the examples I have seen have been really complicated and hard for me to apply it to this one :( Help, anyone? Thank you for your time.
You've just got the rule the wrong way round:
RewriteEngine On
RewriteBase /quiz
RewriteRule ^TaketheQuiz$ ?id=1 [L]
EDIT
Per your comment try this instead:
RewriteCond %{QUERY_STRING} id=1
RewriteRule ^$ TaketheQuiz [R=301,L]