I have a folder in which I store user profile pages. For example, the profile page for the user "JohnDoe" is:
mywebsite.com/user/JohnDoe/index.php
I want to redirect all requests to mywebsite.com/user/*/index.php
to mywebsite.com/user/index.php
.
I read this post and tried redirecting to google.com as a test:
Redirect 301 /user google.com
but this redirects to mywebsite.com/google.com/JohnDoe/index.php
.
I then cleared my browser's cache and tried:
Redirect 301 /user https://www.google.com
Simply put, I am looking for something like:
Redirect 301 /user/*/index.php /user/index.php
but I am not getting redirected. Unfortunately I couldn't find this in the forums. How do I accomplish this, without the existence of the user profile page?
Hope this will help you
put this code in .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^OLDDOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://NEWDOMAIN.com [R=301,L]
from http://www.webconfs.com/154/301-redirects-how-to-redirect-your-website/