htaccess redirect index.php?v=1 to index.html - .htaccess

I am trying to redirect this page /index.php?route=common/home to index.html
and have put this in my .htaccess page:
Redirect 301 index.php?route=common/home index.html
However, I get a 500 Internal Server Error when I do this.
Does anyone know how to do this correctly?
(Note: there are other pages example /index.php?route=checkout which I don't want to redirect)
Any help would be greatly appreciated.
Thank you

Redirect is just really used to make aliases (and is part of mod_alias). Instead, you need to use mod_rewrite, so RewriteRule /index.php?route=common/home index.html [R=301] should work, but check it first.

Related

Setup htaccess not to redirect when hit from main site

I'm not even sure how to ask this correctly so if I am duplicating a question I apologize. How do I use my htaccess file to only redirect when someone is coming in on something other than the main site name?
Example:
I do not want redirect on www.examplesite.com
I do want to redirect on www.examplesite.com/page.php
I think this is what you're looking for:
Perform a redirection with .htaccess
The easiest and simplest way of redirecting with .htaccess is to use the Apache module mod_alias and its command Redirect. Here’s is how to make a temporary redirection with htaccess:
Redirect /page.php http://www.examplesite.com/go_to_this_page.php
Is this along the lines of what you're asking? If so, I hope it can help.
The Structure : redirect accessed-file URL-to-go-to
The code :
Redirect 301 / http://www.examplesite.com/page.php

301 redirect using regular expression in .htaccess

I have suddenly been hit with hundreds of 404 crawl errors to pages which must have been on a previous site (though I thought I'd got them all...). It's a bit strange as I've never seen any page with index.php in it, yet all the errors start with index.php/xxxxx.
So, I want to do the following:
redirect 301 index.php/<wildcard> http://www.example.com
in the .htaccess file.
Can someone tell me whether this is correct, and what I have to put in the <wildcard> place if it is? If this is incorrect, what is the code to accomplish this?
You can use a the Redirect directive in the htaccess file and do a simple regular expression assuming your site doesn't use /index.php/query/parameters like some PHP frameworks do.
Redirect 301 /index.php/(.+) http://www.mysite.com

URL Masking!With Htaccess

I'm quite new here so i have a problem about masking and tried other solutions using .htaccess as well but no luck, that's why im here. Thanks.
Ok here's it is:
I want my http://www.domain.com/article-tip to show in http://www.subdomain.domain.com
It means the page content is from: domain.com/article-tip
But the url above the address is: subdomain.domain.com
How would i do that using .htaccess?
It means i also tried the iframe and frames and php, but i want the .htaccess
Thanks in advance.!
you can use mod_rewrite in that case the URL will be subdomain.domain.com/article-tip but in php URL will be www.domain.com/article-tip.
I don't think you can send dynamic output to browser like what you want with .htaccess
This should work for what you need to get all files in article-tip to point to the subdomain. The subdomain should also point to the subdirectory. This is for the .htaccess of the subdirectory.
RewriteRule ^article-tip(.*)$ http://subdomain.domain.com [R=301,L]
RewriteRule ^article-tip/(.*)$ http://subdomain.domain.com/$1 [R=301,L]

.htaccess for cakephp

I am runing a site wishberry.in on cakephp framework. I had some dirty URLs previously and now i want them to cleanup through .htaccess
I original url was wishberry.in/createwishlist3 and i want to change that to wishberry.in/brands with a 301 redirect.
The reason for using 301 is, if someone type wishberry.in/createwishlist3, the page will take them to /brands automatically.
Can anyone help me out what to write in my .htaccess file.
I would recommend doing this with routes in CakePHP rather than the .htaccess file. See http://bakery.cakephp.org/articles/Frank/2009/11/02/cakephp-s-routing-explained for more details.
The following should do the trick:
RewriteEngine On
RewriteRule ^createwishlist3$ /brands [R=301,L,NC]
Hope this helps.

.htaccess Redict 301: Stop Redirection for Subfolders

Hello and thank you for being there,
I'm trying to redirect the page www.mydomain.com/hello/page to www.mydomain.com/mypage
I'm using this rule
Redirect 301 /hello/page http://www.mydomain.com/mypage
It works fine, but the problem comes now with pages like www.mydomain.com/hello/page/page2
They are automatically redirected to www.mydomain.com/mypage/page2
Is there a way I can redirect all pages that go to /hello/page/(whatever) to www.mydomain.com/mypage instead of www.mydomain.com/mypage/(whatever)
Thank you very much!
So I found a way to do it in case someone runs into the same question:
redirectMatch 301 ^/hello/page/(.*)$ http://www.mydomain.com/mypage
Hope it help.

Resources