How can I redirect my domain to a different page or directory? - web-hosting

Please suggest a method other than use of .htaccess..

It really is homework-due-day today.
Theres httpd.conf (apache)
http://httpd.apache.org/docs/1.3/configuring.html
Or, forcing an "Error 301 - redirect".
Or, you could put a meta-refresh in your webpage redirecting to the new webpage.
e.g.
<meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com">
Or you could use javascript to force the redirect.
<script type="text/javascript">
window.location = "http://www.google.com/"
</script>
Then there are things like Reverse Proxy that could do what you wanted.

Depending on the technology and/or your access to the web server there are various options. In addition to the above you could use a server side code redirect e.g. in ASP.Net
Response.Redirect("http://www.google.co.uk")
I'm sure there are PHP and various other code alternatives to perform the same action.

You can do a client side redirect using an index.html and a META Refresh tag.
<html>
<head>
<meta http-equiv="refresh" content="0;url=http://www.mysite.com/MyDir/MyPage.html" />
</head>
</html>
http://en.wikipedia.org/wiki/Meta_refresh

Implementation-agnostic:
The following status codes can be used in a web server response:
301 Moved Permanently
302 Found
If you don't have access to a decent web server, try the Javascript
or Meta-Tag methods above.
Bonus: another implementation-specific advice, using Hunchentoot:
(redirect "http://otherhost/otherpath")

Related

Why shouldn't I host my own copy of Socket.io?

With a webpage hosted locally on my system, with socket.io installed, this page can be served with socket.io.js attached:
<!doctype html>
<html>
<head>
<title>SkyOS</title>
<script src="/socket.io/socket.io.js"></script>
</head>
<body>
</body>
</html>
But if I want to serve this webpage from a webhost like GoDaddy, that file isn't going to be on the directory through installation.
So, that's simple. Just upload socket.io.js onto the webhost. Except one issue:
I can't find socket.io.js anywhere on the web.
So, according to the answer to this question, I shoudln't ever do that. Am I missing something here? Is socket.io not a normal javascript library like any other?
The socket.io server has got the proper client library available and will serve it from the /socket.io/socket.io.js file (depending on your settings the exact contents may vary).
In case you are not using your socket.io server as the general HTTP server simply prepend the proper host.

HTML META REDIRECT to old URL

I just wanted to redirect from e.g. www.example.com/example to another URL.
I tested it with this index.html in example.com/example and it looked like this:
<html>
<head>
<title>TITLE</title>
<meta http-equiv="refresh" content="0; url=http://sample.org/sample">
</head>
Goto to URL http://sample.org/sample
manually.
</html>
It worked just fine. Then I changed the "http://sample.org/sample" URL to the URL I wanted to redirect to.
But there occures the problem. It still redirects the example.com/example to sample.org/sample and not the actual one.
I tried to clear the cash, history and cookies in Firefox and did a DNS-Flush with "ipconfig /flushdns".
I also deleted the folder example and created it new. But nothing helps.
When I'm accessing example.com/example/index.html it redirects to the URL I want to. But if I'm accessing example.com/example it still redirects to the unwanted sample.org/sample.
Any glues how to fix this?
I just figured out that the proxy in our company also does have a cache. I tested it outside of our company network and it worked just fine. So this is fixed ;)

How to scrape ajax generated content from JSF-Site?

I am currently playing around with different scraping techniques and found out, that it can get pretty complicated quickly when a lot of javascript is involved.
I had some success with HTMLUnit which seems to interpret javascript rather well, but I am looking for a more lightweight solution.
So the problem I am facing now is: I want to retrieve the results of a specific page, which is generated by an ajax call by a click on a certain button.
The call itself is rather simple, just a HTTP Post to a certain URL with a few parameters submitted in the post body. The problem I have now is that the server complains when I submit the HTTP Post to the ajax function without really opening the containing site.
What I basically do for testing is:
curl -v -d "AJAXREQUEST=..." https://myhost/ajaxurl
An what I get is:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Ajax-Response" content="true" />
<meta name="Ajax-Expired" content="View state could't be restored - reload page ?" />
</head>
</html>
The server is running JSF 1.2. What do I have to do, to get the results from the AJAX call? I am not really a JSF expert...
If I had to guess, JSF doesn't have a session associated with the request being sent with curl and therefore the objects associated with the page don't exist. For curl look at http://curl.haxx.se/docs/httpscripting.html section 10, cookies. You would have to pull the page, get the cookies then do the http post with the cookies (starts being a lot of work with curl).
However I would instead suggest looking at Selenium, which has a IDE that generates Java to interact with JavaScript.

Facebook button for Ajax Pages, how to implement and verify that it works

I wanted to know how can I use Facebook Like button on my Ajax web application, that will capture changes in the Open Graph tags for both the og:title and the og:url. I already created a Facebook app and got an API ID.
What I want to know is the code that I need to put on my website in order for Facebook to capture the changes that I've made to the meta tags which contains that title and url information (ie. og:title, og:url).
I followed the instructions on Facebook without success. Furthermore, I want to know how can I locally test the Like button to see that it grabs the data from the Open Graph tags properly.
Also worth mentioning that I've a JQuery code that automatically alters the Open Graph meta tags to include the relevant information for the current Ajax changed page.
Thanks.
You will need to have a separate url for each different page that you want to allow people to like. I would recommend actually pointing the like button to the physical pages you're trying to return via the og:url tag. To refresh the data that Facebook stores about a given url, pass that url into the linter at http://developers.facebook.com/tools/lint.
i created a rotator file for facebook share on my dynamic ajax website.
rotator.asp code sample:
<html>
<% lang=request("lang")
id=request("id")
..some sql to get data...
ogTitle=....
ogImage=....
originalUrl=....
%>
<head>
<meta property="og:title" content="<%=ogTitle%>" />
<meta property="og:image" content="<%=ogImage%>" />
.....
......
<meta http-equiv="refresh" content="0; url=<%=origialUrl%>" />
//dont use redirect.. facebook dont allow 302...
</head>
<body></body>
</html>
for example xxx.com/#!/en/153 page will share xxx.com/rotator.asp?lang=en&id=153

How can a web page be redirected to a data: uri from http://?

I would like to load a webpage with limited contact to a server. I have a cross-application link but safari just will not open the data: uri. Is there anyway to begin that with http://? What about javascript in a url, http://javascript:window.location="data:"? I do not want to have to contact a server (offline stuff).
If not, could I use a simple php page to redirect it?
Ex:
http://someserver/index.php?input="data:text/html;charset=UTF-8,htmlhere"
and in the php script:
<meta http-equiv="refresh" content="0;url=< ?php echo($GET_['input']); ?>" />
Use a meta tag to redirect with the data URI as the url property value:
<html>
<!--Using meta redirect-->
<meta http-equiv="Refresh" content="0; url= data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC">
>
</html>
References
OWASP Fuzzing Code Database: XSS Discovery Statement

Resources