I would like to know, is it possible to change links structure from domain.com/#!/home to domain.com/home
I tried using htaccess but it doesn't change anything. I was looking for information on the Internet and found out that it is calling "ajax crawling". Unfortunately I have not found how to remove/disable/redirect.
Please help me.
You can't modify the URL fragment (everything after the #) using mod_rewrite or an htaccess file. These fragments are never sent to the server so anything on the server side is unable to access them. While you can redirect the browser to a URL with a fragment, you'll never be able to detect whether a fragment exists.
You'll need to do the redirect using Javascript on the browser's end. Check for the fragment and redirect the browser to a URL in the form of domain.com/url.
Related
I am developing single page application using hashbangs(#!)
So the application urls are in format #!/api/generalelections.
When i directly enter this url in browser the mvc does not seem to recognize hashbangs ,it always take me to default action mentiond in glolab.asax.
Could anyone provide me solution to handle this problem to redirect to proper action which is api/generalelections
Everything that goes after # is treated by browser as anchor tag and will not be supplied to the server.
In your Xhr requests to the server you should use 'normal' uris, but not your navigation ones.
Hi Folks,
my first post here, thanks for any help i got already throught reading before.
I am working on a wordpress projekt. And it seems i am missing the overview on my problem.
I use ajax to recieve additional product data. http:url/product/additional_ajax_data...
This works fine, except direct call of the ajax urls. Direct call of a ajax url gives
a 404 not found.
Please dont give instructions like: add 200 ok to header... Cause the project will
consist of some thousand pages and work arounds like this are a no go...
Aditional infos: the urls have no ajax hash tag... And the content will dynamicly loaded depending on last url fragment
I found the solution:
To prevent Wordpress of 404 when calling a ajax url directly, add rewrite endpoints to the system.
You can follow the post from Jon Cave on Wordpress:
http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/
Works also on custom post_types and custom taxonomys, keep an eye on the type for wich you want to register a custom endpoint rewrite (that may depends on your options from your post type, page type etc...).
If you are sure that url is correct and file is there, check if permissions on file are not too strict. Also check .htaccess to make sure it doesn't black certain file extensions to be loaded directly
I couldn't really word the title very well, but here's my problem: I've got a webpage that reads from a database each time the user clicks a button, the content is then replaced for part of the page.
Because it is an ajax load, everything is done in the background, and so the URL stays the same. This wasn't be a problem at all until I realised that I will want to have a different Facebook comments box for each set of content that is loaded - so if someone comments, it is posted to their facebook profile, people click on the link and are then taken to different content.
So... what I need is some way of referencing each set of content, and I've found a site that does exactly that (I'm sure there are a lot of them).
Here's the link.
Each set of content has a different 'hash code' (because I don't know the actual name for it) which is appended to the URL - in this case the code is "#1922934", this allows people to post links to it that specific set of content on Facebook etc. - and also allows a different Facebook comment box for each set of content.
Does anyone know how such a set-up can be achieved or how these 'hash codes' work?
Here's a document from wikipedia on it.
[http://en.wikipedia.org/wiki/Fragment_identifier][1]
The main idea is that URI fragments are used because they don't cause a page reload. They also can be used to refer to anchors on a web page.
What I would do is on page load use JavaScript to read the URI fragment (location.hash) then make a request to your server to load the comments etc. The URI fragment cannot be read by a server and is only found through a client (browser)
Sounds like you want something like SammyJS.
This is weird. I have a virtual directory setup for an MVC3 application called (for the sake of this question) I'll call 'foobar'. The full URL to this site is:
http://localservername.domainname.com/foobar
In my logon form, I have the following line that is supposed to redirect to the main/home page of the application after logon.
return RedirectToAction("Index", "Home");
However, when this line executes, I get redirected to the wrong location - so instead of redirecting me back to:
http://localservername.domainname.com/foobar
I get redirected back to:
http://localservername.domainname.com/foobar/foobar
Which of course gets me a resource not found error. Also, any links in my views seem to do the opposite - for example if I have a link like this:
Widget Search
I would expect the following URL to open:
http://localservername.domainname.com/foobar/WidgetSearch
Instead, I get redirected to
http://localservername.domainname.com/WidgetSearch
Which of course also gets me a resource not found error. I've never encountered this type of behaviour before. I've gone over the basic and advanced settings and created a new application pool. Fiddler also shows me that (of course) the URLs listed above return 404 responses.
Any suggestions would be greatly appreciated.
Thanks!
The first issue shouldn't really happen. RedirectToAction should take into account your virtual directory path (you haven't hard coded an extra /foobar into your route setup have you?).
The second problem has nothing to do with MVC, it's just that you're using a vanilla HTML link that is pointing directly to the root of the server (that's what saying /blah implies). You should change your link to use one of the MVC helper methods to generate the URL instead to make sure it adds the virtual directory for you. So one of the following (the first is probably the best way, unless you need to heavily customise what the anchor tag looks like):
#Html.ActionLink("Widget Search", "Index", "WidgetSearch")
or
Widget Search
I would be grateful to find out some really weird things I have seen on facebook URLs
If I bookmark this URL (found when JS is enabled)
http://www.facebook.com/HumanRightsWatch?v=app_2344061033#!/HumanRightsWatch?v=box_3
Then disable JS
I then proceed to revisit the same url
e.g. http://www.facebook.com/HumanRightsWatch?v=app_2344061033#!/HumanRightsWatch?v=box_3
and its sends me here:
http://www.facebook.com/HumanRightsWatch?v=app_2344061033&_fb_noscript=1
There is no redirection happening, im checking headers and getting a 200 ok
My question is, how is this done? I guess it cant be using JS redirection because thats disabled. Is there any other form of redirection that it could be using without showing it in the headers?
Yours, deeply confused :#
Cheers
Ke
ahh i see, its using a meta refresh tag