Index of folder in wordpress .htaccess - wordpress

When I use the following url "http://www.tuto3d.netai.net/wordpress/" in my navigator I access normally my wordpress site but when I use http://www.tuto3d.netai.net/ I get the index of folder instead and a link to wordpress folder. I want to redirect in my .htaccess the http://www.tuto3d.netai.net/ to the "http://www.tuto3d.netai.net/wordpress/"
and this is my my .htaccess
# 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
Thank you in advance

Have this rule in your DOCUMENT_ROOT/.htaccess:
RewriteEngine On
RewriteRule ^$ /wordpress/ [L,R=301]

Related

Htaccess issue with wordpress

I have a wordpress installed in a subfolder called blog/
I have two htaccess files, one in the root directory, one in blog folder, generated by wordpress.
The first htaccess in root directory:
# BEGIN
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(blog/.*)$
<IfModule mod_rewrite.c>
Redirect 301 "/old_page" "http://example.com/new-page"
...
<IfModule>
# END
The second htaccess in blog folder:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
<IfModule>
# END WordPress
My issue is when I navigate to http://example.com/blog/, I'm redirected to a link like that:
http://example.com/index.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlblog/
I have checked your Htaccess code used for the subfolder URL, it will work fine and I have modified the root directory Htaccess code for redirection.
Please try to below code for this.
RewriteEngine on
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /blog/$1 [L]
SubFolder Htaccess code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
You can use the below code for the old URL to new URL:
<IfModule mod_rewrite.c>
RewriteEngine On
RedirectMatch 301 /old-page/ /new-page/
<IfModule>

WordPress multisite | ROOT redirects to SUBFOLDER

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.

.htaccess rules to have wordpress in root and cakephp in subfolder

i installed wordpress in the root directory of my FTP, and then in a subfolder I install cakephp, however I have a problem with htaccess.
www/
.htacess
(wordpress)
/folderCakephp/
.htacess
(cakephp)
Wordpress 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
Cakephp root htaccess :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Cakephp app/ htaccess :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Cakephp app/webroot/ htaccess :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
the problem is that when I go on www.domain.com/folderCakephp/ I have a Wordpress 404
In the directory where WordPress is installed, i editing the .htaccess file and i have add the following line. (CakePHP subdirectory will be called "cake")
Wordpress .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^cake/(.*)$ /cake/$1 [L,QSA]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
/cake .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cake
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/app .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cake
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/app/webroot .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cake
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
That’s it. You’re good to go.
Visiting example.com in the browser will open your WordPress website, while example.com/cake/, depending on how you configured it, will open your CakePHP app.
I believe the issue is the last line in your WordPress rewrites
RewriteRule . /index.php [L]
This rewrites everthing that isn't picked up by another rule to WordPress. I think you want to change this to match everything but the cakePHP folder using a negative match. I have not tested this, but it should be something like
RewriteRule (?<!folderCakephp). /index.php [L]

htaccess wordpress/index.php rewrite rule

I have put my wordpress files inside a folder wordpress instead of root.
I am able to access my site as www.example.com/wordpress
But i want to access it as www.example.com, want to hide wordpress in url.
my .htaccess file is as
<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>
How can i do this?
Try this:
Add this to the .htaccess in your root directory:
Options FollowSymLinks
RewriteEngine On
RewriteRule (.*) wordpress/($1) [NC,L]

wordpress redirects me to subdirectory folder

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

Resources