Laravel route works with internal webserver but not with WAMP - laravel

I defined the following route in /app/Http/routes.php:
Route::get('products', function () {
return App\Product::all();
});
My Laravel Installation sits in C:\wamp\www\product-service\
When running WAMP, Laravels Welcome Page will be displayed (URL: http://localhost/product-service/public/)
However, the URL http://localhost/product-service/public/products won't work, Error Message "Not Found. The requested URL /product-service/public/product was not found on this server".
Now, when I start the internal test server
php artisan serve --host=127.0.0.1
The URL http://localhost:8000/products will work fine.
Why is that?

First of all, check if you've the proper .htaccess in your public folder. If the file is present, maybe your WAMP environment has the mod_rewrite module disabled. Check the apache conf file in:
{wamp_dir}/apache/conf/httpd.conf
check for this line:
#LoadModule rewrite_module modules/mod_rewrite.so
remove the # at the beginning. Check then for the AllowedOverride param and change No to All. Restart your apache server and give it a try. Last but no least, check the Laravel docs here for another htaccess file that can be useful to you

Related

I've got an issue with using 'visit'

When my Cypress tests are run on Github (headless).
When I call visit('/page') - get a 404 error. The page definitely exists.
CypressError: 'cy.visit()' failed trying to load:
http://localhost:4200/page
I can run the same tests locally (headless and headed) and they work fine.
Anyone have any ideas why this could be?
I should add that this is an Angular Application and there are no 404's because all routes are handled with wildcard. I know this page exists and happens if i try to visit another page that exists.
Version:
"cypress": "^10.6.0",
This is the .yml file. The baseUrl is set to 'http://localhost:4200' in the 'integration.config.ts' file.
So found the answer.
We are serving the Angular application with 'http-server'. It was only recognising the route '/' and was returning a 404 for any other app routes / pages.
We fixed this by adding --proxy http://localhost:4200? to the http-server command.

Laravel admin route is not handel by laravel 6

my web.php file
Route::get('admin', function () {
return view('welcome');
});
it's not working
error im getting in blow page
it's showing apache2 error can anybody know what is wrong.
it should handel by laravel right .?
i m using
Laravel 6
mysql 5.7.29
Ubuntu 18.4
php artian serve gives me again diffrent error show in below
Thanks
The fact that it is showing 403 Forbidden is most probably because apache is trying to directory-list /admin folder but it is prohibited to do so.
I think in laravel directory public folder have the admin folder name. Please check.
If the admin folder exists rename folder name.
So the solution is to make sure that you do not have a folder 'admin' inside public folder.
you should visit /admin to view the page, remove public
You should add port 80 in your url
localhost:80/project_folder/public/admin
or you if you have xampp folder you can edit virtual host document root in vhost file pointed to your project folder
DocumentRoot "C:/xampp/htdocs/project/public"
so you can just use
localhost/admin

Can PhpStorm debug a file that has been redirected to using Nginx's X-Accel-Redirect?

I'm using Nginx's X-Accel-Redirect to serve a file (redirected.php) that is outside of the webroot. The webroot is /usr/share/nginx/html and the file I am wanting to debug is being served from /usr/share/nginx/downloads
I begin Xdebug in the browser (debugging works at this stage). At some point the browser makes a request for website1.com/learning/downloads/url,
Nginx redirects the request to redirected.php using the below rule
# Enable X-Accel-Redirect
location /learning/downloads/ {
root /usr/share/nginx/downloads;
rewrite ^/(.*)$ /redirected.php last;
}
Unfortunately, I can't get redirected.php to pause on any breakpoints.
Is it not possible to debug when using X-Accel-Redirect with PhpStorm? or is it more likely to be a mapping issue? Suggestions on how to overcome this issue would be much appreciated.
It was a mapping issue. Part of the problem was due to redirected.php being in a folder outside the webroot.
To fix it, I went to File -> Settings -> Languages & Frameworks -> PHP -> Servers and configured it as in the picture below.
I also added xdebug_break(); to the code in redirected.php

Laravel-Project deployment via FTP

I want to deploy my Laravel-Project but it always shows me this error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at admin to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
My Server Structure is like that:
/
/protected --> All Files and Folders within the project (+ /node_modules & /vendor) except the /public-folder
/public_html --> all Files and Folders within the /public-folder
I already changed the permissions for the /storage-folder and I already changed the paths in the /index.php to
require __DIR__.'/../protected/vendor/autoload.php';
and
$app = require_once __DIR__.'/../protected/bootstrap/app.php';
Any ideas?
place all the files from your localhost (htdocs) to public_html. Also make sure there is no any redirection in your domain-redirection on your hosting server.
The main reason of the internal server error is that your domain is not pointing the directory which you define.
In my case, the index.php file is
require DIR.'/../vendor/autoload.php';
$app = require_once DIR.'/../bootstrap/app.php';
Do all the changes one by one, this will work in your case hopefully. I have mentioned the reference link below please check
https://laracasts.com/discuss/channels/laravel/laravel-deploying-to-server-using-ftp

Laravel TypiCMS redirects to root

I am using TypiCMS Laravel here : github.com/TypiCMS/Base and I am facing the following problem:
I created a new module named "News" by executing command: composer require typicms/news. I also added providers in config/app.php, have publish views and migrations and migrated the database too.
The only problem I am facing is that whenever the url I given, it redirects me to the root directory of my project, that is, http://localhost/mywebsite/public/
Even, if I give invalid route like localhost/mywebsite/public/foobar, instead of showing me error, it again redirects to the root directory.
I have checked the .htaccess and routes.php file and there is not modifications.
Regards:
Adnan
TypiCMS cannot be installed in a subfolder, the root of your site must be http://localhost.

Resources