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]
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
I am sorry to open a replicated question once again but I had no other choice. I am trying to write a clean URL using .htaccess. Here is my code:
RewriteRule ^home index.php [NC,L]
RewriteRule ^about-us about-us.php [NC,L]
RewriteRule ^careers careers.php [NC,L]
RewriteRule ^contact-us contact-us.php [NC,L]
these works very finely. but when I move on to URL's having some GET params like
example.com/providers.php?provider=huawei
and the htaccess rule goes as:
RewriteRule ^providers/([a-zA-Z_-]+) providers.php?provider=$1 [NC,L]
When I navigate to the URL example.com/providers/huawei it throws an error
Notice: Undefined index: provider in directory\providers.php on line x
Appearantly, there is no error in the rule, I have gone through several video and StackOverflow solutions. Some suggested the use of QSA but no luck. I changed my production servers too still negative. Any help in this regard.
TIA
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
My current htaccess does two simple url rewrites for two simple page. Here is the code.
RewriteEngine On
RewriteRule ^home/?$ index.php#home [NC,L]
RewriteRule ^contact/?$ index.php#contact [NC,L]
now mywebsites.com and mywebsite.com/home are the same pages. I am using the twitter bootstrap carousel to flip slide between page without actually loading them.
Unfortunately the number of facebook share on mywebsite.com/home is 2000 and on mywebsite.com/ is 29. So I want to 301 redirect mywebsite.com/ to mywebsite.com/home but that puts the htaccess into an infinite loop.
any help will be widely appreciated.
The following should allow for only ONE redirection.
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
Does that help?
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]