weird automatic wp redirection - php

When I type the url address of my website with www for example http://www.mayumibeats.com/question it would redirect me to my homepage which is http://mayumibeats.com/ but when i type it without www on it for example http://mayumibeats.com/question it just works fine.
What am I missing here?
Here is my .httaccess
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
NOTE: The site is wpmu

Try changing site URL and home URL, replace http://mayumibeats.com with http://www.mayumibeats.com

Related

How to install Wordpress on subfolder (incl. wp-admin)

I have a domain, www.example.com, and I want to install Wordpress (4.7.4) to www.example.com/wordpress/. I'm also behind a nginx reverse-proxy, but not sure if that's relevant.
The following .htaccess does not work, ie. a GET request to www.example.com/wordpress/ redirects to www.example.com/wp-admin/install.php. I need the entire install to live on /wordpress/ subfolder, ie. www.example.com/wordpress/wp-admin/install.phpetc.
How can I configure this?
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . /wordpress/index.php [L]
create "wordpress" directory in your domain root folder & then add .htaccess as mentioned below.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress

Htaccess - point multiple domain to different path

For example I have a domain example.com and server IP of 12.34.56.78
I need to point example.com to a facebook page, then point 12.34.56.78to my root directory where my website files are saved.
Here's my current Htaccess code
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(.*)$ https://www.facebook.com/examplefbpage/
RewriteCond %{HTTP_HOST} ^12.34.56.78$
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
Currently, both example.com and 12.34.56.78 redirects to the facebook page.
By the way, my site a created using wordpress.
Thanks in advance!

WordPress MultiSite Redirect

A large multi-network wordpress site is auto directing users to the root domain.
Everytime I go to http://sitename.com/username/wp-admin it looks like this:
http://sitename.com/wp-login.php?redirect_to=http%3A%2F%2Fsitename.com%2Fwp-admin%2F&reauth=1
Here is my .htaccess file
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
I've tried disabling all plugins.

How do I redirect all requests to a subfolder keeping the requested page slug intact?

I need to redirect all requests for pages.
Say for example
domain.com/contact
To
domain.com/subfolder/contact
I've checked out a lot of questions but I have some redirects setup in my htaccess file among other WP settings, could someone explain the best way for me to do this and keep the redirect I have?
.htaccess:
RewriteEngine On
RewriteRule ^$ /sandyford/ [R=301,NC,L]
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
You can use:
RewriteEngine On
RewriteBase /
RewriteRule ^$ /sandyford/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^((?!(?:santry|sandyford)).+?)/?$ /sandyford/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([\w-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([\w-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([\w-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

Exclude a specific file from htaccess rewrite rules

I have WordPress installed in my root and its htaccess rewrite rules are preventing me from accessing example.com/file.php and instead redirects to /.
I want to exclude that one specific file from rewrite rules.
Existing htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
You need to add
RewriteCond $1 !^(file\.php)
i.e.
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteCond $1 !^(file\.php) [L]
RewriteRule ^(.*)$ /index.php/$1 [L]

Categories