Why does symlink create an unnecessary "folder"? - symlink

Say the root folder on my server is /home/bong/www/, so mydomain.com will serve up index.php from /home/bong/www/.
Then I cloned an hg repository and placed it at /home/bong/hg/hgrepo/.
When I am on /home/bong/ I created a symlink as follow so that going to mydomain.com will serve up content from the hg/hgrepo directory:
ln -s hg/hgrepo www
When I go into www, I see hgrepo -> hg/hgrepo
Problem is then when i go to mydomain.com, it still doesn't work ... but mydomain.com/hgrepo does.
What did I do wrong?

I'm betting that www already existed, so when you created the link, it placed it inside the directory that was already there. Solution: delete www then create the link again.

Related

laravel symlink is changed when code is pushed to live site

I am using laravel 5.5's storage symlink to store images. When I push code to the git and pull from live site then symlink path on live site becomes same as is on my local code .
My local has this symlink
storage -> /home/path/to/project/app/public/
But live site expects this symlink path
storage -> /var/www/html/website.com/public_html/project_code/storage/app/public/
Every time I have to delete symlink and create it again on live site.
I have do these steps on live site
cd public
rm storage
cd ..
php artisan storage:link
after doing these steps my symlink becomes according to live site and then it starts working.
Live site should have this symlink
storage -> /var/www/html/website.com/public_html/project_code/storage/app/public/
project_code/.gitignore :
public/storage
project_code/storage/app/.gitignore
*
!public/
!.gitignore
How I can get rid of this issue.
Thanks in advance!
As your symlink points to another location within the same project, you can safely use relative paths while linking, instead of having absolute one (which is what artisan is setting up). That would require manual linking though:
cd app/public
ln -s ../storage/app/public storage
Remove current storage symlink first if you have it already.
You might consider setting up a post-receive hook in the target Git repo (the one you are pushing to). See this one for instance.
In that hook, you can add any step you need (like fixing the symlink).

Install Laravel on dedicated server's subfolder

So I am having an issue with pushing a Laravel app to production on a dedicated server's subfolder.
Server is run on Apache.
Url I want to push my app would be subdomain.domain.com/project
The structure of my dedicated server is
.cpanel
...
-laravel
-app
-vendor
-...
-public_ftp
-public_html
-folder
-contents of laravels public directory
-ssl
I know that in order not to expose my hidden files I am required to install it in a root directory, but this is not an option because I will be having multiple projects running under subdomain.domain.com/project-1, subdomain.domain.com/project-2 and etc... and all will have a separate laravel installation.
I need a hand in order to achieve that, can anyone give me some advice?
Managed to do it myself, the problem was when i was creating a symlink, so instead i just moved contents of my public directory to public_html/project-1/ and changed index.php path to /../../laravel/
The thing was that I have done it originally but I didnt expect that permissions for storage need to be manually set, that solved my issue and laravel works.
ALWAYS CHECK ERROR LOGS :)
You can place your separate folders in your subdomain with no problem.
The important thing is that you need to point the browser to public/ folder under your laravel projects.
You can create a .htaccess file with the command below in root folder of each project and perform a redirect.
Place the following command in your .htaccess file:
RedirectMatch ^/$ /public/

Make symlink laravel public folder

i've tried push my laravel 5.1 project to server. I want to make a symlink to public_html folder so i can access it like normal.
ln -sv app/crowd/public public_html
i've tried that one. but the symlink is taking the public folder instead of it's content.
ln -sv ~/app/crowd/public ~/public_html
i've tried that one too but it still fail.
any suggestion how to make it works?
If "the symlink is taking the public folder instead of it's content" means that your browser is giving a 403 or saying you can't access the folder, it may mean that you don't have index.php in your DirectoryIndex directive (if you're using Apache - not sure what the equivalent is on nginx).
When you enter a location in your browser and don't include a filename (www.host.com/page.html), the server looks at a list of default pages and sees if one of those is present. If not, it tries to serve the whole directory. Try browsing to www.host.com/index.php and see what you get. If it loads, you just need to update your config. If not, please explain what you see.

Laravel 4 redirect (homepage)

I have finished my website with laravel 4. I deploy it to my server and find out that I need to go to : www.example.com/public/ to access the homepage.
How to do the setup to access the home page directly when typing the url : www.example.com? I did a index.php with a header Location etc etc but Laravel didnt like it^^
Thx
You have to change your virtual host to point to /public rather than the root of the Laravel (/) installation
You can usually do this if you have access to your web host's control panel.
actually, it's better practice and laravel intends to, if you change your directory structure.
let's say, your current dir structure is like this
./
www/
app/
public/
bootstrap/
vendor/
change it :
./
app/
www/
bootstrap/
vendor/
see? move up app, bootstrap, vendor etc. then rename public folder to (in this case:) www or whatever directory used by server doc root.
Or, if you really don't want change directory structure, you can simply use this:
return Redirect::to('/public');

How To Direct Magento installation path in subfolder to main domain name

I have installed Magento 1.7.0.2 to mydomain.com/mag
(mydomain - is the primary registered domain at my hosting account)
(mag - is any subfolder)
As my website in testing mode, if anything goes wrong, i simply have to delete the “mag” folder and also it does not overwrite any files under public_html.
But if i install on directly to root directly public_html, then it may overwrite few files or folders and if i want to revert any time, then i cannot do that manually.
As i don’t even know the exact folder and file default structure under public_html prior to magento installation.
(I did that once by mistake, that happened)
Now at frontend the site URL will be mydomain.com/mag
But i want, if customers type the http://www.mydomain.com, they will be able to see the LIVE website instead of typing http://www.mydomain.com/mag
How do i do that
Also, will this be OK for SEO part.
Do we need to do this in Magento backend.
or
Do we need to do with hosting company by setting sub-domain type
or
By telling Simple scripts the installation to change the installation folder from mydomain.com/mag to www.mydomain.com
Please do suggest how can i do so.
Regards
In System > Config > Web you will find the following settings for your 'base url'. To update this you will have to perform the following 3 steps:
Step 1: Set the default store to the proper base url
Notice that the base url has the subfolder defined.
Step 2: Set your STORE VIEW base url to the root url
Using your dropdown on the left, change the "Current configuration scope" to your store view [NOT DEFAULT]
To change the base url value, uncheck 'use website' and enter your new base url:
Also, double-check in the same screen that your Session file management cookie path is set to the root folder of your site and that the domain is correct:
Step 3 [also used for multiple store management]
Finally, and this is important, you need to copy the index.php file, .htaccess file, and symlink your media,skin and js folders to your root directory, because they're only available to your subfolder Magento base install right now - we need to let your main domain know where to look for Magento!
From secure shell in your Magento installation directory (in your case, mag) as sudoer:
sudo cp index.php ../
sudo cp .htaccess ../
sudo ln -s js ../
sudo ln -s skin ../
sudo ln -s media ../
Your admin will still be available at yoursite.com/mag/admin.
Edit your index.php file in this main webroot (the file you just copied) and update it around line 45:
$mageFilename = 'app/Mage.php';
Change this to :
$mageFilename = 'cart/app/Mage.php';
Where 'mag' is the subfolder. In your case you'd use the folder named 'mag'. Finally, you need to clear the cache for these changes to take effect.
Step 4: Multi-store [optional]
If you have more than one store, they can all be served this way, but you need to edit the index.php file to give it the correct store code. More info about that can be found here:
http://www.magentocommerce.com/knowledge-base/entry/overview-how-multiple-websites-stores-work
i must say that figuring out how to symbolic link was a hassle and i still couldnt figure it out. All the other steps worked fine except i copied my htaccess and my index.php and i just pasted it to my root. So for those who are having trouble, i found a better solution instead of symbolic link for "media, skin and JS" folders. In your magento admin. System>config under general click web. just change your base skin, media and js to the folder you want them to point to...
ex: {{unsecure_base_url}}cart/skin/
worked for me. Hope it works for anyone with the same problem. Ohh and im using magento 1.8.1 Thanks again #philwinkle

Resources