symfony: change application dir - symfony1

I have ordinal symfony project which includes 2 applications: public and admin parts.
I need to move admin application files to project_path/web/admin. So if I call www.project.com/admin the admin project will be shown.
How should I configure project to allow that ?

Moving an app to the document root would create a security hole since ALL your app files would be accessible to anyone if you don't secure them in any way. If you do not like the default symfony project setup which uses url rewriting for a single app only (the public one ususally) and want to have "clean urls" in other apps as well, you can create subdomains for them and set the "no_script_name" parameter in settings.yml to "on". For example, this way you could have urls like http://myap.domain.com/nice/url/here. In your case, the public app could be on domain.com and the admin app on admin.domain.com. Of course, you would have to configure your Apache vhosts accordingly - this is not something that symfony does for you out of the box.

Definitely do NOT move your files into web/admin
A solution to your problem will very likely be found in the project_path/apps/frontend/config/routing.yml
I had a similar problem before. I created a frontend module and called it "admin" then put links in it that linked to myproject/backend.php/table etc....
you can use the routing file to make www.project.com/admin work
to learn more: http://www.symfony-project.org/book/1_2/09-Links-and-the-Routing-System
remember to enable module_rewrite in you http.conf

Related

IIS 6 .NET MVC web app deployment - need to achieve a specific URL structure

I need my local (testing) deployment to respond to a URL like
http://localhost/apps.mydomain.com/myappname
not
http://localhost/myappname
Long story as to why but I just need that to be the case.
I actually had this working for awhile but I can't remember how. I had to delete and add the site again and now can't figure out what combination of settings gave me the result.
How can I achieve that URL structure locally?
MORE INFO: I've created a website called "apps.mydomain.com". I then added an application under that site with the alias "myappname". This app can be invoked with URL
http://localhost/myappname
Why? What happened to "apps.mydomain.com"? When I add it...
http://localhost/apps.mydomain.com/myappname
I get a 404.
You can just create directories apps.mydomain.com and apps.mydomain.com\myappname under C:\inetpub\wwwroot.
Or, if you don't want to publish your application in wwwroot, you can create virtual directory in IIS.

having multiple mvc projects under same url

I was wondering if it's possible to create an mvc project with layers inside or even multiple projects using the same web address.
Like if I have a website called mysite.com which have a website project doing sine stuff.
But then I have a webproject which I'm doing some experimentational code on which I whould like to find via the url "mysite.com/test". This whold be a dufferent mvc project. Is that even possible?
It is possible, what you actually need to is create a new project and define it inside a virtual directory.
MVC is based on global.asax and web.config configurations and you can't have 2 separate projects inside the same application. In the scenario you described, it sounds like you need to create a "Virtual Directory" in IIS for the second application instead of making just a "Sub Folder".
The Virtual Directory will allow you to declare a new web.config and global.asax where you set the new routings and configurations method for your second application and this will also give you the freedom for independent updates without affecting your main project.
For a full walkthrough on how you can perform this please refer to this site:
http://msdn.microsoft.com/en-us/library/vstudio/bb763173(v=vs.100).aspx

How do I serve static files from mvc without using content folder?

I want to be able to have a folder which allows regular access like the \content folder except that it holds a ClickOnce application. I can't seem to be able to achieve this using Mvc, but I'd like to have this folder accessible without Mvc seeing it as a controller action.
I tried using routes.Ignore(theUrl), but this seemed to have no effect.
There are two ways you can do this. The first is where you are currently going, which is to satisfy it with routing. You should be able to use the following to ignore the intended route:
routes.IgnoreRoute("...")
However, this might not be the right approach from a security stand point. I would recommend you define an explicit action to download your click-once exe. Have a look at this q/a as an example of using the FileContentResult class.
The reason for this is that you can control security for that file without having to open up access levels to other directories.
Edit: If this is for an entire directory, you can still follow this same approach.
Set up the folder as a virtual folder in the website on IIS. then you can set the url in the code to point to the machine serving the request and to the virtual folder on the web server.

how to create two separate projects?

I have shared hosting(godaddy).
I have subdomain "car".
I need create 2 project. in the project root 1 project in subdomain 2 project.
www.site.ru - project first.
www.car.site.ru = project second.
How do this?
but I have added to the root of your project and project car has stopped working.
in iis I do not have access
this can be easily done by creating the subdomain. Just create the subdomain and install the app which you want to use in the project. You can upload files to your subdomain, the same way you do for your main domain.
As i know you should a subdomain and assign a separate web application to it.
Like:
www.site.ru ==> MySite
www.car.site.ru ==> CarSite
This could be however limited by your hosting plan to have only one web application.

What is the proper way to deploy Orchard CMS to shared hosting?

I've created a basic website using the Orchard CMS, and attempted to deploy it to my shared host, Softsys, using Web Matrix (via FTP). Currently, the site technically "works", however it looks like all styling has been removed (even from the dashboard).
Is there a step or files that I missed while deploying the site? I know "Web Deploy" is probably the preferred method of deploying, but I'm pretty new to this, and was not sure what the login specifics were, or how to obtain them for web deploy.
Here is a screenshot of what the site currently looks like deployed:
Edit: it turns out that the problem was on my host's side, for some reason the virtual directory was not being created properly - I still am curious what the proper/best practice method to deploying is however.
It looks like you have no theme applied. Check whether you have your theme existing in ~/Themes folder and properly enabled in the admin Dashboard. Maybe the /Themes folder content hasn't been copied?
UPDATE
If your hosting provider allows the option to deploy sites via WebDeploy - that would be the best one.
The easiest and most straightforward way to deploy Orchard site is to:
Have the ASP.NET application properly configured in IIS and accessible. If you use hosting - provider does that for you. If you'd have a dedicated server - you have to set up an application yourself.
Grab the deployment package from Codeplex, or build one from the sources.
Copy the whole package to your site's root (via FTP or WebDeploy).
Run it and proceed with the setup.
Basically - these are the same steps as for every "ordinary" ASP.NET application.
You probably need to set IIS user to have write access to some of the folders: Themes, Media and App_Data.

Resources