I have a ubuntu server that has a wordpress installed on with link "https://gditac.com"
after that I installed another wordpress on subfolder like "https://gditac.com/news" but the problem is the second website redirects on first and show 404 not found page. I searche a lot but couldn't solve my problem.
here the htaccess for the root website :
# 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
and here the htaccess for subfolder website :
# 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
any idea whats going on?
I think best way is to create a subdomain e.g. news.gditac.com, install there your wordpress and make a permanent redirect from https://gditac.com/news to https://news.gditac.com
If you really want to install it on a subfolder then read this article:
https://wordpress.stackexchange.com/questions/134839/is-it-possible-to-install-wordpress-within-wordpress-installation
Alex
Related
I have a problem on my WordPress multisite. There's a WordPress installation on the root folder (public_html) of my domain and it was working fine.
We had to install a second WordPress site in a subfolder (public_html/subfolder).
If I try to access example.com/subfolder, the second website works fine.
If I try to access example.com, it redirects to example.com/subfolder. I no longer can access the first website.
ROOT .HTACCESS
# 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
SUBFOLDER .HTACCESS
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subfolder/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subfolder/index.php [L]
</IfModule>
# END WordPress
Can someone explain how to prevent this redirect?
Thanks!
Try to delete (or rename) root .htacces.
I have two Wordpress websites, one is in root and another in subfolder.
example.com and example.com/newsite
When I open example.com/newsite/ all is working good, but if I open any pages likes
example.com/newsite/about or example.com/newsite/contact
browser auto redirect to
example.com/about and example.com/contact
I changed all paths, address, home url in config and sql to example.com/newsite/
Root htacess looks like:
# 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
htaccess for /newsite looks same.
Can anybody help me?
You should be using a different rewritebase if it's in a sub directory. Your wordpress rules in side htaccess under /newsite should look something like this.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /newsite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Good day everyone,
On my Wordpress website, I had a plugin that transfered external links through virtual site.com/go/abc123xyz style links.
I have removed the plugin but obviously, when I checked G webmaster tools, there were many Not Found errors for all of those virtual links.
All I wish to do is redirect all of those /go/links to one particular external link. I'm looking for a redirection rule which will redirect all links from the virtual /go/ folder to my specified link.
Would be really thankful if anyone can help me. Thanks!
Try adding:
RewriteRule ^go/(.*) www.mysitedotcom/out/link.php?id=$1 [R=301,NC,L]
To your default 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
So it should look like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^go/(.*) /out/link.php?id=$1 [R=301,NC,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I hope that answers your question and helps you.
I was asked to move one working WP site (site 2) onto a folder of another WP site (site 1)(because the first site is being blocked in China and the second isn't).
so the complete URL ended up being www.site1.com/site2
I managed to do so but the links on the second site are no longer working, they show a 404 from site 1 but the URL seems OK
www.site1.com/site2/path_to_page_on_site_2 -> 404
I assume it is because of the .htaccess from site 1:
# Redirect images
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^font/(.*)$ /wp-content/themes/site1/font/$1 [L]
RewriteRule ^timages/(.*)$ /wp-content/themes/site1/image/$1 [L]
RewriteRule ^images/(.*)$ /wp-content/uploads/images/$1 [L]
RewriteRule ^videos/(.*)$ /wp-content/themes/site1/video/$1 [L]
</IfModule>
# 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
Site 2 has a "standard" .htaccess from WP
# 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
if it is an htaccess problem, how can i stop the htaccess from site 1 affecting site 2?
if it is something else, how can i fix it?
thanks in advance
I managed to do what i was after thanks to Nikola's comment. This is the final htaccess file for site2
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site2/index.php [L]
</IfModule>
# END WordPress
I wanted to redirect all the calls to site2 to the appropriate folder so relative paths were not affected but was not able to do it with htaccess, so i had to do a replace in the database to make them absolute.
I have wordpress installed in subdirectory folder named "thumbs". I also followed the steps here.
Everything works fine but if I go to www.mysite.com/wp-admin it redirects me to www.mysite.com/thumbs/wp-admin, I don't want that to happen because I want the subdirectory folder to be secret.
So what I want is if I visit or somebody visit www.mysite.com/wp-admin I want the wordpress 404 error page to display. Thanks in advance for the help.
What am I missing?
You should modify your root .htaccess (not thumbs/.htaccess) file to add a rule for wp-admin, e.g. :
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin - [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Change your HTACCESS with this code
# Switch rewrite engine off in case this was installed under HostPay.
RewriteEngine Off
SetEnv DEFAULT_PHP_VERSION 53
DirectoryIndex index.cgi index.php
# 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