I have a site that I run off the back of another site. In order to save on hosting etc. the domain points to a script and depending on the url that is in the address bar it redirects accordingly to a subfolder which holds the separate sites. I am happy with this and it works a treat. So when it hits url 1 it goes to "www.domain1.com/url1/Home/Index" and when number 2 is typed in it goes to "www.domain2.com/url2/Home/Index". url1 and url2 being the subfolders.
The problem comes when i am developing another site that is going off the back of the original. i have the site developed in vs and am about to release and obviously all of the image urls, script urls etc are completely wrong as they don't take into account the subfolder within the site. they all used /images/site/image1.jpg etc. this means that they are looking from the root and not from my subfolder url.
is there a simple way of implementing this so that i can develop it using vs and not have to change every image reference every time i release code?
i realise this probably has an incredibly easy answer to my problem - i just can't seem to find anything that fits.
Any suggestions?
slight addition to this - when my site loads it loads to the default page - and therefore when i use ../images/site etc this works when the url contains Home/Index, but not when it hits it on the default url which doesn't include the folder and page qualification.
Just noticed this was left unanswered. When referencing in MVC you need to use the tilde (~) to reference the route of the application. So in my instance i have two sites and using the tilde notation if referenced the route of the application, of which each were specified as different routes.
Related
Somehow my DNN has a broken path a particular url serves pages, but doesn't work for delete or advanced options (delivers a 404 error)
The taburls table has no entries for this tab.
If I change the url through the tabs table then I'm able to delete the page without issue.
I tried accessing the page options via tabid, but the tabid gets converted to the friendly name and then 404s.
I tried turning off friendly urls in my web.config but I may have done it wrong since the entire site would not load (yellowscreen of death)
I'm wondering where DNN is storing this path that is breaking the advanced options of whatever page is at the path.
How do I fix this url so it displays page options and lets me delete pages?
First thing I would try is going to the Admin/Page Management screen, can you make the changes you need to via that interface? If so, after making the changes, are you able to access the page and all the features/options correctly?
If that doesn't work, check the TabPath column in the TABS table to see if there are any bad paths in there for specific pages that you are having problems with.
Here is my issue. I have a Angular/WebAPI project hosted in IIS 8 within a subfolder of the domain. When I access the site with a trailing slash after the folder name, everything works ok. But if I leave off the trailing slash, when Angular adds the '#/' for the route, it breaks.
Example: http://www.domain.com/folder/ becomes http://www.domain.com/folder/#/ <- OK
http://www.domain.com/folder becomes http://www.domain.com/folder#/ < - Breaks
The AngularJS Template I started with does not have this issue. I do not understand what is causing this issue and I don't know how to proceed.
Additional Info on the project
I am using MVC Bundles to minimize the javascript and css
I have WebAPI controllers in the same project
I am using Microsoft OWIN for authentication in the same project
Other than this initial URL issue, the project runs correctly.
I can not reproduce this issue in Visual Studio, but VS doesn't run in a folder.
I can post Angular routes if needed.
This is an issue with how relative pathing works in HTML and not something specific to Angular. This is a result of the original specs for URLs and relative links before there was really even a concept of virtual URLs.
Relative links on your HTML page go from the same base as the HTML "doc" itself. Therefore, if the url is:
http://domain.com/folder/
then, your browser anchors relative URLs at
http://domain.com/folder/[relativePathHere]
The browser assumes that it's looking at the default doc (index.html, home.htm, etc.) in that folder -- what originally was an index of the files in that directory. However, without the trailing slash, the browser thinks "/folder" is actually a file called "folder" that is sitting in the root doc directory for the server (as it has no way of differentiating -- it doesn't care one way or the other whether there is a file extension). So, all relative paths are anchored at
http://domain.com/[relativePathHere]
That's why you're having issues with your relative pathing without the trailing slash. To correct this, you will want to put a rewrite rule into place in IIS. This way, you will be immediately redirected to the version that has a trailing slash before the default HTML file is delivered. This is a very common thing to do (not just for this type of case -- it's also important for SEO so that crawlers don't think that there are two distinct pages).
Check out tip #1 in the following link: http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/
Follow the directions for adding the trailing slash, and you should be set.
i'm using dot net nuke
and i need to rewrite my website urls
for example: from products.aspx to products-computers/home.aspx
I've tried modifying siteurls.config using this rule
<LookFor>.*/products.aspx</LookFor> <SendTo>~/products-computers/home.aspx</SendTo>
it doesn't work.
Please help!
If you are trying to change the URLs of your website, you will need to use a tool like URLMaster from Ifinity to get the ultimate flexibility
What you are doing with the siteurls.config appears to be is define that if someone requests /products.aspx that instead of loading a page called products.aspx, they load a page with a path (defined in DNN) as /products-computers/home.aspx
That means that you need to have a parent page called Products-Computers and a child page under there called Home.
I used to edit siteurls.config and it worked for me - you should be careful with syntax though. What I don't like re siteurls.config is that you're ending up on right page but with wrong address in address bar of the browser. So my preference is this solution that I investigated & tested personally and it was confirmed by stackoverflow community member as well:
redirecting old site pages to single page on dnn portal
i need to remove sitemap.aspx from the site.
In dnn 6,there is a sitemap.aspx page that simply shows an xml sitemap.i cannot edit/remove that file.so i need to remove that page and recreate it with a simple html sitemap.
NOTE:the page name should be sitemap.aspx
Sitemap.aspx isn't a physical page you can delete.
You can, however, rename it to something else. It's in your web.config file, under the 'handlers' section. Just look for sitemap.aspx, and change it to something else, like 'searchenginesitemap.aspx'. Don't forget to update your robots.txt file to point to the new sitemap name, or go to the various webmaster console pages in search engines and advise them of the new location.
The sitemap.aspx is used to create the xml sitemap for search engines. By changing this you break this functionality and limit the search-ability of your site.
That being said, in Host Settings->Advance Settings you could setup a new Friendly Url that would match .*/sitemap.aspx to another url/page on your site.
I have long stopped using DNN's native sitemap.aspx... ITS BUGGY!... and here is how i found out.
I generated my own "CLEAN" sitemap.xml using a free 3rd party tool. And uploaded it to the root of my DNN website.... re-submitted the the domainname.com/sitemap.xml to Google via web master tools and as a result we now get a 1ST PAGE and TOP 10 RANKING.
Mostly in the top 5... where as before using DNN's native sitemap.aspx we would get random errors which was pretty ANNOYING. Plus we got very bad Google Page Rank, But those were just my findings of better results. Note:I also place the location of the sitemap within the robots.txt file...
Although i will admit that it is extremely ANNOYING that you cannot just edit the DNN Sitemap url. This creates an issue if you've built the the site on a test server and then migrate over to production... your DNN Sitemap url only reads the firs portal alias from when you first developed the site.
Anyway, this was my findings... others may vary... just sharing.
I want to have two separate interfaces to my website, one that is silverlight, and one that is normal html for people who don't have Silverlight, and for search engines. They would have exactly the same content, the Silverlight one would just be a richer experience.
If someone with Silverlight copies the URL to a certain page, it will have a '#' in it (app#page1). If they then want to link to that page on their blog or something, it will have the # in it, and a search engine probably wouldn't consider it as a separate page from app#page2.
Is there any way to make the navigation from within Silverlight update the URL with a '/' instead of a '#', without actually loading a separate page? This way the URLs in the address bar appear like a normal websites' URLs ('app/page1', 'app/page2').
Is there any way to make the navigation from within Silverlight update the URL with a '/' instead of a '#', without actually loading a separate page? This way the URLs in the address bar appear like a normal websites' URLs ('app/page1', 'app/page2').
Unfortunately, no. The reason that Silverlight navigation URLs use # is that you can move around within a page by moving to an anchor location. If you used a full URL with '/' separators, it would cause the browser to navigate to a new page, which would reload your Silverlight application. This would basically unload your Silverlight application, and load a new one with the new URL.
The reason they use the # sign is because this is interpreted by the browser as moving to a location in the page, otherwise would reload the page.
As far as search engine implications I'm not sure either way. Maybe someone more experienced with SEO can chime in on that.
However I'm sure you can get the behavior you're looking for, just may take some trickiness on your end. Another way pass information to the Silverlight client runtime is using Query String parameters. You can access query string params using the System.Windows.Browser.HtmlPage.Document.QueryString collection, you could then load the Page or User control with the content you desire based on that parameter.
As far as mimicking a folder structure using '/'s. I know there are ways to do this using custom web server settings / HTTPModules. I assume you're using IIS/ASP.Net, I would look into this from Guthrie:
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
Takes a bit of hackery, but if you're really set on doing it I'm sure you could. You will also face the things the above poster mentioned, if you attempt to do use the same logic during a session. This may work though for just the deep linking aspect you're looking for.