Laravel 4 in a subfolder - html

I have a test project on Laravel 4, and I'm still new to this. I'm still working on wamp (localhost). I have already made it work as long as laravel is installed on the root path of wamp (..wamp/www), but when I try to create another folder (..wamp/www/testproject) and install laravel there, the routes are not working anymore except for localhost/testproject/laravel/public.
to summarize:
--The working one---
C:/wamp/www/laravel = the folder where laravel was installed
localhost/laravel/public = working, "You have arrived" page
localhost/laravel/about = working about.php route
--The one with errors--
C:/wamp/www/testproject/laravel = the folder where laravel was installed
localhost/testproject/laravel/public = working, "You have arrived" page
localhost/testproject/laravel/about = not working about.php route
localhost/testproject/laravel/index.php/about = working, and I don;t know why
can someone help me with this? why is it that the "about.php" page is not working on the subfolder? :(
EDIT: .htaccess file content
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
here is the screenshot for the routes..

Add RewriteBase /laravel/public below RewriteEngine On in .htaccess

Related

on refreshing page , not found error, need solution without using # [duplicate]

This question already has an answer here:
Cannot load routing modules after building in Angular
(1 answer)
Closed 2 years ago.
I have a angular 9 project. I deployed it to server. On server when I refresh angular app, it shows error :
Error:
start
Not Found
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
end
we are using below for development
server : Apache
frontend : angular
backend : nodejs
I did not understand what happened. I tried this solution
link to solution what I found
but We don't want # in over url. with out #, we want solution.
please suggest proper solution.
thanks for your time.
Build your app like this using angular cli.
ng build --prod --base-href /<project_name>/
Try with this in .htaccess one and let me know as It works for me.
Put .htaccess in src folder (final path for is src/.htaccess) and give the file path in angular.json inside "assets"
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
Reference
You need to place a .htaccess file on the root of the deployed project i.e. along with index.html. Below is the code to be written in the above file.
<IfModule mod_rewrite.c>
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html
# to allow html5 state links
RewriteRule ^ index.html [L]
Please see the below image -

Image url being treated as a page request in yii2

I am working on a project which is developed in Yii2. Today I came across a weird and funny issue of image url being treated as a page request.
When I try accessing image with url as https://www.websitename.com/images/image1.jpg, it shows me the image. And when I try accessing image with url as https://www.websitename.com/images/image1-lockdown.jpg then it shows 404 Error. On checking I found that internally the request was changed to "/site/images/image1.jpg". As we all know to access images no controller call is made.
Same issue was generated on local machine (Ubuntu 16.04). Just added "lockdown" into the name of image url.
I am using Yii2 Advanced Template. OS: For production CentOS and for development Ubuntu 16.04.
Note: I couldn't verify if the same issue exists for windows or not.
Kindly Help!
Edited: .htacess (root folder on production)
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule admin(.+)?$ /backend/web/$1 [L,PT]
RewriteRule gamer/(.+)?$ /gamer/web/$1 [L,PT]
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ /frontend/web/$1 [L]
</IfModule>
.htaccess (frontend/web on production)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

Yii2 The requested page does not exist **Not Found (#404)**

I'm new to Yii2,
here is the website almousa.net
the issue here that I can not go to the backend, I always get The requested page does not exist and the page title Not Found (#404)
I tried everything from changing the .htaccess to changing the url
how can I solve that?
I noticed that there are no index.php in the website base folder and as if all the requests are going to the front end
Even I have installed a fresh copy of Yii2 advanced and following standard steps I got everything OK. But the same problem like you mentioned here that the backend was not working.For this I added an additional .htaccess file inside backend folder(/backend) with the following code:
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ web/$1 [L]
</IfModule>
# Deny accessing below extensions
<Files ~ "(.json|.lock|.git)">
Order allow,deny
Deny from all
</Files>
# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]
Please do follow and I hope it helps.Your config settings must be correct in addition to 1 more .htaccess inside backend/web folder with the following code:
RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php

Index.html is not my default page (somehow my wiki overwrote it)

I installed mediawiki on my website. I had a problem where my wiki pages started with www.mywebsite/mywiki/index.php/mywikipage. I wanted to get rid off this "index.php" so I made short url to my wiki with this website: http://shorturls.redwerks.org/. From here I got one code to .htaccess:
DirectoryIndex RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteRule ^/?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]
And another what went to LocalSettings.php in my wiki folder:
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/w";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgGenerateThumbnailOnParse = false;
After this I had no more problem with the URL of my wiki pages. But my website front page goes to wiki now. I want it back to index.html. I tried to put this code into my .htaccess file but still doesn't work.
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
DirectoryIndex index.html
Any help would be great! Thank you!
The rule is currently rewriting homepage to /w/index.php
Change this :
RewriteRule ^/?$ %{DOCUMENT_ROOT}/w/index.php [L]
to
RewriteRule ^/?$ %{DOCUMENT_ROOT}/index.html [L]
so that a request for hompage can internally redirect to /index.html

How to force http- NOT https using htaccess

I have ONE directory for my entire domain that I want to force https, which is "/docs". In the /docs folder, I have the following htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
This is forcing https to everything in the /docs directory, which is what I want it to do. The problem I am having is trying to force REMOVE https back to http for all other areas of my site. In the root folder of the site (which is running wordpress), I have the following htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/docs/?.*$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
Unfortunately, this is not working. I can still access other areas of my site over https.
What do I need to change to get this to work correctly?
Since the accepted answer doesn't actually answer the question, I figured I'd post my solution to this. Add this to your .htaccess file to force HTTP instead of HTTPS:
# BEGIN Force HTTP
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
# END Force HTTP
Try the Force non-SSL plugin for wordpress.
The "WordPress Force HTTP" plugin was the only thing that worked for me. It changes https to http for not just the front page like most of the answers out there, but also changes https to http for all sub-directories in your website.
https://en-au.wordpress.org/plugins/wp-force-http/
Why do you need to revert back to http? If you have the proper SSL certificates you might as well keep your access secure. Unless you are concerned about the load on your system.
I know this is not answering the question, but I want to emphasize that the question is asking on how to do a bad practice, which shouldn't be done in the first place.