This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to redirect non-www to www URL’s using htaccess?
My htaccess file is doing nothing although I am adding folloeing code in it.(I think it is not enable)
My current website address is like that www.abc.com/mvc/view/index.php
And the new address is www.abc.com/index.php
My hosting provider is godaddy.com. and there is also PHP.ini file in the same directory I have placed htaccess file in the root directory seems like html/.httaccess.The complete htaccess file is like
Redirect /mvc/view/index.php http://abc.com
But its not working.I am confused about .htacces file placement and also the rewrite code line. Can you please help me out?
The syntax for Redirect looks correct. Please note that you need to have a FileInfo permission:
Description: Sends an external redirect asking the client to fetch a different URL
Syntax: Redirect [status] URL-path URL
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
You should ask your hosting provider whether you're allowed to use this directive.
Related
I use from http://siteold.com/json/ in my application and can not change it.
and my new domain is http://panel.sitenew.com/json/ . how redirect my old url to new url without change in application ?
this way does not work (in siteold.com) :
RewriteEngine On
Redirect http://siteold.com/json/ http://http://panel.sitenew.com/json/
I don't think it is possible to redirect a URL to another URL. You will have to create a htaccess.txt file to the directory of the website you want to redirect, and then use this code
Redirect /siteold.com/json/ http://panel.sitenew.com/json/
This will redirect the old file path to the new file path. You cannot add http:// to the origin domain as the code doesn't work like that.
Source
I have a URL http://domain.com/foo/bar/100. I want to remove /foo/bar from the URL without redirecting it.
Please help me with this problem as I am new for htaccess.
is this URL created by .htaccess rules?
if not: change your document root or add a location directive to the server.
I got an installation of owncloud that exhibits strange behaviour. My biggest problem currently is that the installation is at subdomain.domain.com but the file share tool removes the subdomain from the url.
e.g.:
Correct link would be:
http://subdomain.domain.com/public.php?service=files&t=download
But the user gets output this:
http://domain.com/public.php?service=files&t=download
Can I fix this by using htaccess rewrite?
a need redirect
http://www.mysite.com/product.php?id_product=216
to
http://www.mysite.com/category/newProduct.html
I try to add a line in htacces
redirect 301 /product.php?id_product=216 http://www.mysite.com/category/newProduct.html
but dont work.
If I add
Redirect /product.php http://www.mysite.com/category/newProduct.html
All links like
http://www.mysite.com/product.php
http://www.mysite.com/product.php?id_product=216
http://www.mysite.com/product.php?id_product=219
Go to homepage http://www.mysite.com/
Any idea. THX
Check the following:
Make sure your file is called .htaccess, not htaccess as you say above.
If you're using FTP to transfer it to the server, use ASCII rather than binary transfer mode.
Make sure the .htaccess file is in a directory where the Apache AllowOverride directory option is on if you're using apache web server.
I'm moving my blog which was in a physical folder (/blog/) on my IIS 6 web server to a virtual directory called the same name (blog) running BlogEngine.net, the virtual directory is running in the same application pool as the parent website.
I want to redirect each .html post to the new BlogEngine.net URL. e.g.
http://www.mywebsite.co.uk/blog/2009/06/old-blog-title.html
to
http://www.mywebsite.co.uk/blog/post/new-blog-title.aspx
I already have Helicon ISAPI Rewrite Version 3.1.0.58 running on my website and currently have redirects working fine. But redirects to the blog virtual directory don't seem to work.
Current .htaccess rule:
#rewriterule ^blog/2009/06/old-blog-title.html$ /blog/post/new-blog-title.aspx [R=301,L]
Question 1: Should I add the .htaccess rules to the blog Virual Directory root or the main website root?
Question 2: What .htaccess syntax should I be using to redirect to the virtual directory?
Thanks in advance for your help.
I didn't get any response, but managed to figure it out myself. Is there a StackOverflow badge for that LOL :-)
I'm answering my own question just incase anyone else has the same problem.
Answer to Question 1
The .htaccess file should be located in the virtual directory root, but you can't edit this in the Helicon Rewrite tab of IIS 6 for the virtual directory as it wants to save the .htaccess file in a physical directory called /blog/ rather than the virtual directory.
Answer to Question 2
The rewrite needed to be amended slightly due to the .htaccess file location within the virtual directory. Basically removing blog/ from the beginning of the old url.
rewriterule ^2009/06/old-blog-title.html$ /blog/post/new-blog-title.aspx [R=301,L]
Your rule is OK if you need to redirect just a couple of blog articles, but if you'll have hundreds of them, you'd better have a look at mapfiles functionality of ISAPI_Rewrite here.
but you can't edit this in the Helicon Rewrite tab of IIS 6 for the virtual directory
This problem was fixed in build 62, so update and enjoy.