.htaccess for cakephp - .htaccess

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.

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.

Redirecting /folder/ to /file.html in magento

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.

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.

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

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.

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]

Resources