How to change hashbang url to history API - ember.js

I'm using ember1.0-rc3, i want to change hashbang urls into normal url format (ie, www.site.com/admin#/page1 to www.site.com/admin/page1).In order to make this change,i use location: "history" in app router.
But when i reload a page or bookmark a page doesn't works, it redirects to home page only.I want the options reload and bookmark in my app, without changing redirect urls in .htaccess file.Is there any way for it?Thanks in advance

In order to use HTML5 history with a single page app like ember, your server must be have the behavior of rendering your main index.html file for any URL. The Ember router has the logic to look at the URL when it loads and go to the correct route.

Related

Redirecting old urls to new urls in Django

After publishing site in Django, I changed my slugs and now old pages show as errors in Google search. Is there a way to automatically redirect them without having to write an individual redirect for each page?
There are a few things you need to do to make sure that your website gets crawled properly.
In regards to the redirection, you can use django.http.HttpResponsePermanentRedirect to perform the redirection. Just keep the view, and when a user navigates to this view, redirect them to the proper URL.
You should also create a sitemap, which lists out all of the URLs for your website. You can then submit this sitemap to google using their webmaster tool if you have not already done so. This will inform their crawler of all the pages that they need to crawl without worrying on them missing some information

django redirect to subdomain with exact same url

I have a Django website accessible at codewithbishal.com. This is basically a django blog website and all the blog articles are accessible at codewithbishal.com/example/<path>
But now I want to completely restructure the website{such that it is accessible at blog.codewithbishal.com/<path>} and I do no want to lose the current SEO therefore I want to configure django redirect such that when someone launches codewithbishal.com/example/<path> through google search search result or directly through link, they are redirected to blog.codewithbishal.com/<path> instead of a 404 page and eventually google will start showing the new links instead of old once.
Update: Should I configure redirect through apache .htaccess?
You can use the Django redirects app. Just click the link and find the guide.

How to redirect from the Django login page to a single page application?

I am building a SPA React application that is served by a single Django view at /. I am using Django's admin page for login.
If an unlogged in user navigates to /#/accounts/ the Django admin page will correctly them redirect to http://localhost:8000/admin/login/?next=/#/accounts/pp01/ for login. Once they log in, they get redirected to my Django view that is configured at the / url path.
The #/account/pp01 part of the redirect gets lost and the user gets redirected to the wrong part of my single page application (http://localhost:8000/#/). Does anyone know how to get this to work?
I don't understand why Django is cutting off the # part of the URL. Any insight would be appreciated. Thanks!
You need to encode the redirect path. As it is, your browser is thinking that it should go to '#/accounts/pp01/' on the path '/admin/login?next=/', rather than the hash being part of the redirect path itself.
You can use urllib.request.quote to quote the path.

Replace, not append to, the site's body content in Ember.js

I had the following idea: my page at example.org serves classic HTML from the server. Besides, EmberJS is loaded, too, and waiting to come into action:
as soon as somebody hits an ember route then, for example example.org/#/login, the current should be replaced by what the view renders for it. From then, the whole app should serve as one-page-app.
Is that a good idea? Anyway, I don't know how to get that started. Overriding View's appendTo method or setting the rootElement property as in http://emberjs.com/guides/configuring-ember/embedding-applications/ does not suffice because if that were the body, the view output is just appended thereā€¦
If your entire Ember application requires a user to be logged in, it is valid to have two separate "apps":
A regular non single-page application (server-side using rails, PHP or C#) with a sign up and login pages
A single-page application (i.e. Ember) send as soon as the user hits the login button in your regular app
You will have 2 index.html pages, one for each application (and it's okay to do that!). The URL of the Ember App could be under example.org/app/.... You will need to configure the router of the regular application to server your Ember App for all URLs starting with /app/.
Does that help? :)

Passing a rendered Django page into a Wordpress frame

I have a client who has an already-completed wordpress site, and they want to add osqa.net into the site. I'm the Django dev on the project, and I'm a little behind on my wordpress.
Is there a way to embed another web application's content into a wordpress page's content?
Should I just be doing this with an iframe? I would have to pass parameters from the wordpress url into the iframe url.
edit: Ideally anything in the url after /questions (like parameters and paths) would be passed onto a django application. The django application would render a response, wordpress would take that response and include it in it's page. Are there wordpress plugins that already exist like this?
You'd need to hack OSQA to hide extraneous HTML and return only the pieces you want to include. That seems like a lot of effort for minimal benefits. I'd use an iframe.