Zend Framework 2 index.php in root folder - zend-framework2

I am bulding a website with zend framework 2 and a URL typically looks like this:
domain.com/public/routename/action/params
In the skeleton application i don't have index.php by default, so i created one what basically includes the index.php from the public folder.(This is absolutely not the correct solution). What works but slows down the whole website, also the redirect plugin still redirects to domain.com/public/routename/action/params insetad of domain.com/routename/action/params
How could i skip the "public" in the URLs and get the redirect plugin to work?

Either you can do this from webserver from where you can point the public folder index.php so either point the domain to zf2 you should point to zf2/public/index.php
Another way is you can use htaccess and remove the public url

You should configure your web server so that it serves from public instead of the ZF2 root folder.
Not sure if you use IIS or apache or NGiNX, so without those details it is hard to say what you need to do exactly. But it should be easy to find a 'how to' for your particular web server.
It comes down to configuring what folder should be server for that particular virtual host.
Google can help you

Related

URL Routes In IIS7 MVC 5 (Single Paged Application)

After publishing a MVC5 web application of mine to my IIS server (Individual User Accounts), it would seem that the URL is accessed incorrectly.
During debug, it would be e.g http://localhost:1234/api/Account/UserInfo?=XXXXX
The debug works just fine. The only issue kicks in after I've published it via my IIS7 server.
After publishing and using Google Chrome's console, it would appear that the page is requesting for a resource at mydomainname.com/api/Account/UserInfo?=XXXX instead of mydomainname.com/WEBAPPLICATIONNAME/api/Account/UserInfo?=XXXX.
My best guess is to modify the URLs in /Scripts/app/app.datamodel.js but it would just cause more parsing problems.
I've searched around and can't seem to find any related problems. I hope someone here will be able to lend a hand.
Look like you are using relative path like "/api/Account/UserInfo". Instead i'll recommend you to use #Url.Content("/api/Account/UserInfo"). This will solve your problem
Explanation
In local system when we run application in WebDev server it never have sub folder (like WEBAPPLICATIONNAME) therefore you relative path work correctly. but when you host your application in IIS under Default website in another new website /Virtual folder (like 'WEBAPPLICATIONNAME') then "/api/Account/UserInfo" fall back to Default Website because for '/' in starting. #Url.Content or #Url.Action make sure to add virtual directory name, hence changing your path to "/WEBAPPLICATIONNAME/api/Account/UserInfo" in IIS.

Running MVC application on IIS without domain

My application contains lots of links to the root ("/login/dologin"). When I'm running the application under a domain, there's no problem.
Right now I'm moving to a new server, and I can't test my application. My application sits in "localhost/md", I need the link to go to "localhost/md/login/dologin". Instead, it goes to "localhost/login/dologin", and, ofcourse, the resource cannot be found.
What do I need to configure on my IIS to make this works without domain?
Thanks.
It's just a guess, since you haven't posted any of your configuration.
In your authentication element in the web.config, do you have the route to the login page specified as /login/dologin? could you try ~/login/dologin
The second option, should give you a relative path from the home of the virtual directory application, rather than going to the root of the 'site'
For referencing files (e.g. javascript & css) you could do #Url.Content("~/path/to/file.js")
EDIT: Based on additional comments
in Layout.cshtml...
var SITE_ROOT = '#Url.Content("~/")'
then in your JS file use SITE_ROOT as a prefix in your routes
var url = SITE_ROOT + "Home/Index";

Joomla Site URL

I have a website on a 1and1 server. I have 2 domains on the package; the default url somenumbers.websitehome.co.uk and my actual URL.
The problem is, Joomla quotes the somoenumbers.websitehome.co.uk in system e-mails instead of my actual URL. They both point to the same directory I just don't want to give a stupid URL to my users.
I think I have narrowed it down to the $siteUrl variable but I'm not sure how to go from here.
Thanks
James
At first I thought this sounded largely like a DNS issue - but then you said you only have 1 Joomla installation and both domains point to that directory.
If they're both pointing to the same directory, then both domains will display the same Joomla installation. That is, unless you're checking to see where they are coming from and having the content display dynamically based upon how they got to your site - but from your comments I doubt you're doing that. How your domains are behaving is the expected response if you're pointing them both to the same directory.
If you want 2 sites on the same hosting? Setup 2 databases (or apply different prefix for each site and use 1 database) and set up each website in it's own directory.
Adjust the DNS of each domain name (and subdomain name) to point the appropriate directory.
From there, use the .htaccess file and SEF URL's to get rid of any indicator of the directory so that it displays the same as if the site was in the root directory.
That is the best way to accomplish what you're after - because from the sounds of it Joomla is doing exactly as it should, displaying correctly what is in the directory since both domain names point to the same directory.
$siteUrl should be left blank.

Joomla, move whole site to different domain name

I have a website built in joomla and it is live on the web at a url:
http://oldsite.com
I have been asked to move it to another url - domain name
http://newsite.com
How should I do this correctly without messing up the site and joomla installation??
I did not find any references in Joomla to the domain that it is running under, so there should be no need to change anything. If the site name changes as well, update /configuration.php.
In practice, you may find that there are links with fully qualified domain names in your content that you will have to change. Queries like the following can help you find them:
SELECT * FROM `jos_content`
WHERE `introtext` like '%mysite.gr%' or `fulltext` like '%mysite.gr%'
If you are on Linux, run the following from the site root directory to make sure that there are no other references in the code, such as hardcoded image paths in templates or the CSS, etc:
find . -exec grep -iH "mysite" {} \;
Check the .htaccess file of the site for any custom rules that require a domain name.
So the problem is reduced to changing the domain for an existing site, or to creating a new site and moving the Joomla installation in the file system, and/or creating a copy of the database. The exact steps depend on your environment.
In Addition to what cdonner said , you need to modify the configuration.php file and remove all ref to the old site
You also need to empty the (cache folder)
Are you moving the site to a new host or account or just changing the domain name?
If you are just changing the domain name -
All you really need to do is keep the old domain name pointed to the same Joomla install and add a rule in htaccess to update the domain name to the new one. This not only fixes any fully qualified domain names in links within your content or modules, it also fixes any backlinks that might exist from old domains. Here is what you need to add to htaccess -
RewriteCond %{HTTP_HOST} ^oldsite.com [NC]
RewriteRule ^(.*)$ http://www.newsite.com/$1 [L,R=301]
If you are moving the site to a new host, do as Hanny says and use Akeeba backup to move the site.
In both cases you will want to make sure the old domain is forwarding to the new one and you have the above htaccess rule set up to fix any links that might otherwise be broken.
An important thing to do when moving from one domain to another is to ensure that both the log_path and the tmp_path reflect the new server settings and that they are both writable by Apache. If you don't do that, then you will likely have problems logging in to the server.
You will also need to ensure that the cache and the administrator/cache folders are also writable by Apache since Joomla 3.6.+ is throwing a fatal error if you're using file caching and these 2 folders are not writable.

symfony: change application dir

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

Resources