laravel lumen installation inside wordpress installed directory - php

I have installed WordPress in root directory, I want to install laravel lumen inside a subdirectory. It gives wordpress error " No Page Found!".
I can access files from other directories.
My lumen .htaccess file code is
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
I have nothing special in wordpress .htaccess file.
What i have to do ?

Update your .htaccess file. Add
RewriteCond $1 !^(YOUR_LUMEN_DIRECTORY)
After
RewriteEngine On
Sample .htaccess rules:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond $1 !^(YOUR_LUMEN_DIRECTORY)
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Related

Laravel all routes except home page '/' return 404

As the title says, all the routes in my laravel app except the home('/') route result in a 404 error.
it works in local server but in production in Ubuntu server return 404.
That is the .htaccess in public folder
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

File .htaccess in Sub Folder (Wordpress inside Laravel)

I have Wordpress apps inside Laravel. This is what it's looks like.
public
--article
WordPress inside article folder. The reason I do this because I want it to access WordPress like this
{host}/article
There is issue occured. I can access {host}/article/wp-login.php. But when I fill The Login Form out and then send it, I got Laravel 404 Not Found Error Page.
This is weird because several days ago I can do that, but now error occured.
I think I miss some configurations in the .htaccess but I don't know the error.
This is my Laravel .htaccess configuration
# public/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
and this is my WordPress .htaccess
# public/article/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteOptions inherit
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /article/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /article/index.php [L]
</IfModule>

Laravel routing failing after moved to other server

In my Dev server which is on my pc, I set up vhost to change my URL to dmb.dev to remove the public in URL so many of my routes started at / slash. After I transfer my project to our test server I configure some settings to allow me to remove public. Now, all assets are working except my routes because I'm still having http://server/dmb instead of http://server I'm getting an error of Failed to load resource: /myurl.
My sample routes
Route::get('/', 'PagesController#index')->name('index');
Route::get('/generate_bing', 'PagesController#generateImage')->name('index.getImage');
Route::get('/users', 'PagesController#showUser')->name('users')->middleware('auth','role:owner');
My root htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Do I need to change all routes to dmb/etc.. I'm thinking of solution of removing my root folder so it would look like http://server, but there's other project on our htdocs so I need to remain it store in their folders. BTW I'm using xampp
As you have dmb as your folder under public_html, adding one line to your htaccess would solve the issue.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /dmb/ // ADD THIS LINE HERE
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Laravel: No http in my url

If I want to access my site http://www.myawesomesite.com it simply rewrites to www.myawesomesite.com.
I host my site on my VPS and I not tinkered my .htaccess.
How to tell the rewrite engine, that I want to see the http allways if I'm on that VPS? (and not on local)
My .htaccess file is:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

wordpress install on same domain with laravel on apache ubuntu

I have installed wordpress with laravel 5.3 in news directory inside /var/www/html/public/news/ folder.
mydomain.com/news will redirect to mydomain.com/public/news/ as an 404 error page by wordpress.
Although mydomain.com/news/ some normally.
So, what is the cause behind and how to resolve it?
My .htaccess files are as follows:
root directory /var/www/html/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
/var/www/html/public/ directory
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond $1 !^(news)
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
/var/www/html/public/news/ directory
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /news/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /news/index.php [L]
</IfModule>
# END WordPress

Categories