301 redirect in laravel using.htacess - php

I am working on a project that was developed in core php. But now I have completed in laravel farmework. Now I want to redirect some pages to my laravel routes. Let's take an example.
www.example.com/Special-Feature.php?tid=262 //this core php url
Redirect to :
www.example.com/view/event/262 //my laravel url
Now if I hit this url:
www.example.com/Special-Feature.php?tid=262
it must go to my laravel url:
www.example.com/view/event/262
Can anyone help me how to do using htaccess?

Related

Redirecting to angular frontend after logging in with Laravel Fortify

I made an authentication system using Laravel sanctum and Fortify for the authentication and Angular for the frontend.
The problem is that after logging in I need to redirect to my frontend homepage, I tried this solutions but they didn't work:
setting fortify home parameter as:
'home' => 'http://127.0.0.1:4200/',
making the home route in Laravel redirect to this url (results in a core problem from my frontend)
Route::middleware('auth:sanctum')->get('/home', function (){
return Redirect::away('http://127.0.0.1:4200');
});
how should I do this? is there something I need to do with sanctum?

Laravel 5.6.12 how to redirect to plain html angular 4 app after login

I want to use my laravel installation as a session and request handler without using blade view templates. I've added an auth controller to the app with:
php artisan make:auth
And login, register, forgot password etc. all work perfectly. What I wanna do though is to redirect the user to an angular 4 single page app that resides in a subfolder named dashboard-dist in laravel root which I build independently from the laravel project. In other words I don't want to use the V in MVC of laravel and have angular handle the views.
I want to use restful API calls to laravel controllers to do the rest of back-end business apart from login, register etc.. How can I redirect the user to index.html inside this folder and keep the session goodness at the same time and have restful request handlers work?
1) Compile your angular app
2) Change your angular index.html entry point to be index.blade.php and move it to the views folder, then fix all js and css files connections
3) Create a route to render that view
4) Use return redirect(route) to redirect to that route from wherever you need
5) ...
6) PROFIT!!!11
First I edited the config/view.php:
'paths' => [
resource_path('views'),
public_path('dashboard-dist'),
],
And then built the angular project to reflect that base href change:
ng build --base-href /dashboard-dist/
And voila... Angular 4 inside the laravel goodness.

admin page code igniter doesn't work because laravel valet?

i have php project with ci framework. then i install laravel valet. I access my admin page using this domain myprojectname.dev/admin. but the admin page return is 404Page Not found. can somebody help me to fix this ?
If You using codeigniters routing, then You should write like: myprojectname.dev/index.php/admin, if You hav not `.htaccess file in Your root folder

Kohana 3 - Redirect to other localhost project

$this->request->redirect('localhost/project2/');
From a controller in project1, I have this code, but it's always redirecting me to localhost/project1/index.php/localhost/project2. How can I properly redirect to localhost/project2/ ?
I tried using header() to redirect but its not working in Kohana. Im using Kohana 3.2 in PHP 5.5.12
You should use http before link to specify it is a complete URL:
$this->request->redirect('http://localhost/project2/');
And you shouldn't use the localhost as a static text in your code because your server will changed, you should use on of the ways to return your server root like $_SERVER['HTTP_HOST'] or if you use a MVC framework you can use its function that return base URL.

can laravel & wordpress play together?

this is my problem with laravel & WordPress:
i need to put a blog inside laravel installation.
i want to use WordPress but i can't figure it out.
i put the WP files inside public/blog/ but i can't install it.
the redirect is the error part.
i need to say that to Apache:
if( $url = public/blog/* ){
ignore normal laravel routing system & redirect to WordPress inside (public/blog/*)
}
To keep your laravel .htaccess clean, just copy the .htaccess from any active wordpress project using clean urls (or look in wordpress doc) and copy it to your clean wordpress folder in public/bloc (it's nearly the same as for the laravel).
Without the .htaccess in your blog folder the laravel "public/.htaccess" redirect all not specific and existing files url to "public/index.php"
to solve this I just put the laravel folder next to the wpBlog folder.
& used namespaces to redirect the user to each based on the used url.
SO:-
blog.website.com : will redirect to the wp blog
site.website.com : will redirect to the laravel website

Categories