I somehow messed up my htaccess file which altered my website base URL. The htaccess file is in my public-html directory. My web site URL is supposed to be: http://voidnow.org
I was trying to redirect traffic from voidnow.org to voidnow.org/community, but, I obviously messed it up, royally.
Attempts to reach that voidnow.org on the web take everyone to the following URL:
/community/http://voidnow.org/community/http:/voidnow.org/community/http:/voidnow.org/community/http:/voidnow.org/...
(that erroneous URL reiterates for hundreds of characters.)
Can someone help me with the correct htaccess command to restore my correct URL direction in my htaccess file. I tried removing the htaccess file, and it has no effect. I tried restoring the original htaccess file, with no positive result.
Thanks in advance.
David
If you were using 301 redirects then try clearing browser cache & restart (browser) .. or try another browser -- modern browsers do cache permanent redirects.
Right now your site works fine for me -- no redirect at all.
Related
A typical .htaccess redirect looks like this:
RedirectMatch 301 /old-page /directory/new-page
I am trying to redirect only a specific, root level page (which doesnt exist), to a page with the same name, but in a different directory- and am getting a loop (because apache is seeing "oh that ends in /whatever, lets redirect it again). Here's my redirect example, does this have an obvious problem?
RedirectMatch 301 /specific-page-name /directory/specific-page-name
The purpose of this is to add a UTM code to a page when it gets typed in from some physical marketing media (flyer, card, etc) to give them an easy to type url, and get analytics that let us know that they are coming to the site from a specific non-web source.
I want to redirect mysite.com/index.php to mysite.com/clientarea.php using .htaccess does not work for me help out.
with simple code.
I have tried several time and finally the site is not available
Try running Windows Network Diagnostics.
DNS_PROBE_FINISHED_NXDOMAIN
Based on that error, it appears you're redirecting to a different hostname than mysite.com - I assume unintentionally.
If you can post your .htaccess code, the solution may be easy to provide.
I need to redirect this URL (http://www.example.com/learn) to this URL (http://www.example.com/learn-it).
Problem is that it matches the rule on the redirected URL, and makes an infinite loop.
This does not work:
Redirect 301 http://www.example.com/learn http://www.example.com/learn-it
.htaccess 301 Redirect
The smoothest way to redirect your visitors is to use an .htaccess redirect. This has no delay since before a page is served to the browser the server checks first for an .htaccess file... if it sees this the old page never loads, instead visitors are sent directly to the new page.
These are a few .htaccess redirect codes that I've used that might come in handy for you. This is not a complete list by any means, but it took me ages to find how to do these so I'll save you the hassle and list them here. Oh, and please don't email me with questions about how these work, like I said, I found these with the help of others.. I have no idea in the slightest how to write this stuff and take no credit (or responsibility) for how they work.
If you're more technically minded than I am and want the information straight from the source, check the Apache Tutorial: .htaccess files for more detailed info.
Important notes about htaccess redirection
Always be sure to upload .htaccess files in ascii mode, sending it up as binary will break it (and usually make your server very, very unhappy.)
.htaccess does not work if you're on a windows server.
Make sure you triple check your changes. Clear your cache and look, test the server headers to make sure you see a 301 (that means its permanent) not a 302 (temporary) unless you are absolutely sure you really mean temporary.
Since some operating systems don't allow you to make a file without something before the "." you may need to save it as something.htaccess, some may even have to save it as htaccess.txt and change it once you've uploaded it.
Make sure your ftp program will show .htaccess files (FileZilla does and is free) It is a bit hard to edit something you can't see ;)
Double check that you're not overwriting an old one (some servers already place one there for your custom 404 pages etc.)
Make sure you replace example.com with your own sites URL ;-)
To Move a single page
Quick, easy and seamless for your visitors.
Redirect 301 /oldpage.html http://www.example.com/newpage.html
To Move an entire site
This will catch any traffic on your old site and redirect it to your index page on your new server. If you want to redirect each page to its new spot, this isn't the one for you.
Redirect 301 / http://www.example.com/
For detail explanation. How to redirect page usin .htaccess . read this
You should use RedirectMatch in order to use regex to be able to match exact URI:
RedirectMatch 301 ^/learn/?$ /learn-it
Make sure to clear your browser cache before testing this.
Internet research didn't help me so I am desperately to ask the community for an answer. The problem is:
we have transferred a webshop from Joomla-Virtuemart to PrestaShop. Now we have a problem with redirecting URLs.
For example, the following syntax in .htaccess doesn't work:
Redirect
301 http://wedding-shop.com/ch-de/Brautschmuck/Schmuckset-Miranda http://wedding-shop.com/de/brautschmuck/61-schmuckset-miranda-braut.html
What it does, is replacing the /ch-de/ in initial URL to /de/ and shows the non-existing page which raises 404 error.
After talking to my hoster, which helped me preparing .htaccess file, he told me, that there should be some logic in PrestaShop for that. I am desperately trying to find this out, but resultless.
Another problem are the type of URLs
.../ch-de/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=2484&category_id=90&option=com_virtuemart&Itemid=1
which doesn't work in .htaccess file. Here, I have no idea why. I have about 700 of this type of URLs.
Would appreciate any hints to solve this problem...
Thanks in advance,
Lionna
You can't match URL's http:// part in Redirect directive. Use this instead:
Redirect 301 /ch-de/Brautschmuck/Schmuckset-Miranda http://wedding-shop.com/de/brautschmuck/61-schmuckset-miranda-braut.html
Grüezi Lionna,
Try out this code:
RedirectMatch ^/ch-de/(.*)$ http://wedding-shop.com/de/$1
I need to redirect my site from, say:
http://www.foo.com/index.cfm
to
http://www.foo.com
In this application, index.cfm is my default page (set in IIS). When I try a 301 redirect, I am getting a redirect loop error. The whole app is in ColdFusion. I am updating this setting in IIS on my index.cfm page. Please give some advice on this. Thanks in adv.
So in IIS your default page setup looks for index.cfm? I think you are getting the redirect loop because to the server http://www.foo.com/index.cfm is the same as http://www.foo.com.
It sounds like you are wanting to just hide the "index.cfm" from being displayed to the user?
In this case I don't think that trying to use a 301 redirect is the way to go.
You might want to take a look at IIS 7's URL rewrite feature, and look at Approach #3
Well I don't know coldfusion but you may condition the 301 header output just if the URL used to access the script index.cfm has any character extra on it (just if the request method is GET), this way you'll avoid infinite redirects. Here some pseudocode to explain myself:
if URL is not 'http://www.foo.com' and method is 'GET'
output header '301 http://www.foo.com/'