Deploy Laravel in var/www/html - php

I have the following file structure on my server
/var/laravelapp -> this is the entire laravel project.
/var/www/html/eduapp - > this is the public_html folder which has a folder called eduapp with the public contents of laravelapp.
The login register and home page work
https://example.com/eduapp/
when i click on the other buttons in the homepage the url becomes https://example.com/routename therefore giving an error
if we manually add eduapp in the link eg. https://example.com/eduapp/routename it works!!
any suggestions or solutions?

so these are the things that made the app work
Changed APP_URL to example.com/eduapp.
Changed back button hrefs to href='../routename'.
Created Symlinks for public/img and storage folders.
Removed Slash from href routes.

Related

laravel 5.8 issue with direct nav link and redirect route

This is a bit of an odd situation but I have a nav link on my laravel site that I changed to go directly to an aws bucket file
<li>Images</li>
However, the old site had this nav direct to files in the local site storage (site->public->images->assets) at www.mysite.com/images
Is there a way so that if someone has a bookmark or hardcodes the link www.mysite.com/images it will direct to that aws link? Or can I set a route to go straight to it in that instance?
I set a route with a redirect for Get::'Images' to the link but the issues is I have the folder of the same name in my public folder. Can I ignore that folder?
new route:
Route::get('Images', function(){
return redirect('https://aws.images');
});
Because a folder with that name exists in your public directory it's being handled by your web server first and doesn't let Laravel know about it. So you have to config your web server to redirect to your new location.
As you're using apache you have to add this line to .htaccess file:
Redirect 301 /images https://aws.images

Laravel URLs not working in subfolder

I've finished my laravel project and played it in a subfolder on my domain.
https://example.com/swap
So the above is the root of my directory and when I go there, I do get the index. But now every link I press, I'm redirected to the root of my domain. So I'm getting:
https://example.com/events/1
Instead of https://example.com/swap/events/1
Am I forced to change all URLs by hand in my files are is there a way my htaccess can always redirect to this 'swap' folder and place everything behind that?
I've tried using groups in my routes, without success.
Use url for all your links which are inside views folder:
For subfolder link use:
Sub-Folder Link
For root folder links use this syntax:
Index
There might arise issues with stylesheet and javascript in 'swap" sub-folder links with a 404 error. To fix that, use:
<script type="text/javascript" src="{{asset('js/app.js')}}">
<link rel="stylesheet" type="text/css" href="{{asset('css/app.css')}}">
You need to direct your VHOST to laravel's public folder. This is done for security purposes. Ideally your laravel install is outside the public folder, thus you would have yourdomain.com contain your laravel install and rename your public folder to swap.
IF you really want the name swap in your routes you could use route prefix with groups.
Open .env File and Change Your App Url to https://example.com/swap/ and use routes as links of whole application
All Url's Will Work fine.
When putting a laravel application in a subfolder. You need to modify your .htaccess for subfolder hosting. And add the following:
RewriteBase /swap
This way, the app knows when you go to route {{ url('/hello-world') }}, it will ultimately go to "/swap/hello-world"

Cakephp Controller index link not working without trailing slash

(First question on stackoverflow. Tell me what I can do better)
When accessing controllers index pages it is not important if i type a trailing slash or not. Cakephp redirects both versions automaticaly.
Now my 'videos'-controller is behaving weird. It worked fine 2 days ago but now I cannot accessed it without a trailing slash.
Examples:
domain.com/users/ -> Working user index site
domain.com/users -> Working user index site
domain.com/videos/ -> Working videos index site
domain.com/videos/add/ -> Working videos add site
domain.com/videos/add -> Working videos add site
domain.com/videos -> Domain redirects to domain.com/webroot/videos/ and a MissingControler Exception is thrown. The error message is:
Error: WebrootController could not be found.
In the case you tried to access a plugin controller make sure you added it to your composer file or you use the autoload option for the plugin.
Error: Create the class WebrootController below in file: src/Controller/WebrootController.php
I have not defined any Routes for Videos. I made no changes to the htaccess files.
Can anyone help me with this error? Should I post additional source code?
It's because you have videos folder inside your webroot directory. Please change folder name or apply a route.
Thanks,

Configure Magento Inside another Magento folder

I want to configure Magento site inside sub folder but parent folder also have Magento site.
For example:
app/
skin/
media/
js/
beta/
.../
.../
I want to configure Magento inside beta folder but due to parent magneto .htaccess, beta URL doesn't work. Only home page loads but further links are not working.
here is my site URL
http://tradeplumbing.co.uk/
and
http://tradeplumbing.co.uk/beta (only home page work If click on any link this redirect to main site)
Have you modified the paths in the core_config_data table?
You need to change web/unsecure/base_url and web/secure/base_url to be you new path with a trailing /.
If you have multiple stores you will need to modify them too.
Also if you have full paths in the database for the templates, JS and CSS files, rather than relative paths, you will need to modify these database fields in core_config_data too:
web/unsecure/base_skin_url
web/unsecure/base_media_url
web/unsecure/base_js_url
Once all that is done you will need to delete the cache (/var/cache) and any session files (/var/session) files to force the files to be regenerated.

How to configure internal url's content on Symfony

I am new to Symfony and I am trying to understand how a Symfony project works. Right now I am trying to change the content of an internal url. For example, in the layout.php file, I can put a sentence like:
Suecia
This works fine, when I press 'Suecia' "Button" it changes the content, and it adds viajesDeusto/new to the url. My question is, where can I change the content that the "viajesDeusto/new' url displays?
Thanks a lot
If you split the url in your url_for() function it breaks out to MODULE/ACTION
So go into your app (%SF_ROOT_DIR%/apps/%APP_NAME%)
inside that folder you have a modules folder
inside that you have the module name
inside that you have an actions folder and a templates folder
the actions folder is where your code to retrieve/process data resides
the templates folder is where the presentation code resides
For instance, if your app is called frontend the location of the code is:
%SF_ROOT_DIR%/apps/frontend/modules/viajesDeusto/actions
%SF_ROOT_DIR%/apps/frontend/modules/viajesDeusto/templates
This is the standard setup for syfony 1.x apps

Categories