Redirecting /folder/ to /file.html in magento - .htaccess

We published an article in the magazine with following url:
http://magnetic-sleep-machine.com/moves
Now we need to make sure when people put that URL they land to
https://magnetic-sleep-machine.com/moves.html
Please help me figure this out! .htaccess or use a magento (1.7) option?

There's a way to redirect using magento, but not sure if that's exactly what you want.
You could also try turning on multiviews, and let mod_negotiation take cure of fuzzy URL-file mapping, in your htaccess file:
Options +Multiviews
Or using mod_rewrite:
RewriteEngine On
RewriteRule ^moves/?$ /moves.html [L,R=301]
Or using mod_alias:
RedirectMatch 301 ^/moves/?$ /moves.html

Okay I found the way to do it using magento itself.
created a new Page
page link named as "moves"
added javascript for redirect to body of the page
next went to system>config>web>
set Auto-redirect to Base URL to NO
Voila, it works now.

Related

Redirect 301 www.example.com/directory/tour1 to www.example.com/tour1

Hi I have a situation with the mytic HTACCESS file. Im trying to fix a broken URL.
this folder never existed was a permalink created in WP.I need to redirect 301 all this broken links to avoid problems with Google.
The URL used to be like this
www.example.com/directory/tour1, www.example.com/directory/tour2, www.example.com/directory/tour3 and so on.
Now the url has changed so all the tours are under the root
www.example.com/tour1, www.example.com/tour2...
I need to make that all the queries to www.example.com/directory/WHATEVER
to point to www.example.com/WHATEVER
Thanks for helping me understand this universe of redirections... \
i HAVE TRIED alot of codes, none of them does the job.
RewriteRule ^tulum-tours/(.*) http://www.aguaclaraproject.com/
In your .htaccess in your www-root use the following rule:
RewriteEngine on
RewriteRule ^tulum-tours/(.*)$ /$1 [R,L]
Change the R flag to R=301 after testing it works correctly. Read the documentation for more information.

Remove word from end of URL using htaccess

I have a bunch of URLs coming up as .../undefined which get a 404 error, and I'd like to know how to removed the word "undefined" from the end of the URL using .htaccess
I have looked at many posts about removing extensions, queries, and URL-internal folders, and have tried adapting those rules to suit my purposes, but so far I haven't been able to make it work. Any ideas?
Sample URL: http://www.theveggietable.com/blog/vegetarian-recipes/sandwiches/true-veggie-burgers/undefined
I just want the word "undefined" to be stripped out so that the user is automatically redirected to http://www.theveggietable.com/blog/vegetarian-recipes/sandwiches/true-veggie-burgers/
Thanks!
Try:
RewriteEngine On
RewriteRule ^(.*)/undefined/?$ /$1/ [L,R=301]
or:
RedirectMatch 301 ^/(.*)/undefined/?$ /$1/
redirect 301 should do the trick
redirect 301 /undefined http://www.theveggietable.com/blog/vegetarian-recipes/sandwiches/true-veggie-burgers/
You can use the mod_rewrite module in your .htaccess file to modify the URL. Although, it seems like you're doing something wrong in the back-end if you're getting those kinds of URL's. I would suggest looking into why you get undefined in the first place.
For more information on mod_rewrite, see this blogpost.

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]

redirect old pages to new seo targets

i have a litte problem :(
on my site i created with mod_rewrite some rules...
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([0-9][0-9][0-9][0-9][0-9][0-9][^/]+)$ /index.php?lang=$1&i=$2&cat=$3&item=$4 [L]
with that rule i recieve the following link
/en/article/category/item/021205
with this code above is everything ok..
now my problem is that i changed my site for SEO.
the link looks now like this
/en/article/category/item/021205-seo-link-is-here
my problem are the pages in google and co..
is there a way to create rule that i can redirect:
/en/article/category/item/021205 >> to >> /en/article/category/item/021205-seo-link-is-here
my site is multilangual /en /es /fr if it is important for the rule
best regards bernte
If your want to do the redirect for each page on your own, then the order of your RewriteRules is important.
Better solution would be to ignore the seo-link in your index.php unless the articleId is unique

.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.

Resources