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]
Related
I've read a lot of threads on this topic, but I'm not very proficient at this stuff and nothing has worked for me.
I installed Wordpress in a sub directory and:
Changed the site address URL to the main domain in WordPress.
Then I copied the .htaccess and index.php to the root directory.
Then I changed the index.php file so that the require(‘wp/wp-blog-header.php’) pointed to the subdirectory.
Everything works, except the subdirectory shows in the URL, which I would like to hide.
The subdirectory I installed to is 'NA20H'. After changing the index.php file to point to it, this is what I have.
The .htaccess file in the Root directory reads:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /NA20H/index.php [L]
</IfModule>
And the .htaccess in the subdirectory reads:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /NA20H/index.php [L]
</IfModule>
What do I need to do in order to get 'NA20H' to stop showing in the URLs?
Thank you.
No need to copy index.php to root. Just follow these steps.
Put this in the .htaccess in the root.
RewriteEngine On
RewriteBase /
RewriteRule ^$ NA20H/ [L]
RewriteRule ^(.*)$ NA20H/$1 [L]
Put this in .htaccess in the NA20H folder
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
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]
I have Wordpress installed in root and a particular folder not related to Wordpress. I created a .htaccess file for the particular folder, but it is not working. The Wordpress .htaccess is always been called.
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
Particular folder .htaccess:
//301 Redirect Old File
Redirect 301 http://www.domain.com/folder/start.php http://www.domain.com/folder/index.php
When I load the above old address (that does not exists), the Wordpress .htaccess is called, instead of use the folder's .htaccess to redirect.
You don't need multiple .htaccess you can put all the rules on the WordPress main .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !^folder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Use either:
RewriteRule ^folder/start\.php$ /folder/index.php [R=301,L,NC]
Or
Redirect 301 /folder/start.php http://www.domain.com/folder/index.php
Don't forget to change folder to your actual folder name.
I am using GoDaddy Delux Hosting, Linux server. I have a wordpress installation in the root directory. I've started a development directory under the root directory. I don't have a wordpress installation under the development directory, but my own project.
My objective is to circumvent wordpress url rewriting just for the development directory, and redirect every url that starts with the development directory to development/index.php. I have experimented with numerous mod_rewrite combinations, but I couldn't get it work. I get the standard wordpress "page not found" page for everything except mysite.com/development/index.php
The last configuration I've come up with is the following:
root directory .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(development|development/.*)$
RewriteRule . /index.php [L]
</IfModule>
development directory .htaccess file:
RewriteEngine On
RewriteRule .* index.php [L]
Any ideas how to best approach this?
PS: I haven't used "development" in Wordpress as a slug.
In the main .htaccess file you should ignore anything under "development" - you don't need the initial forward slash because of RewriteBase / and you can make the trailing slash optional with a ?, and there is no need for .*$.
In the subdirectory you ignore anything not in the subdirectory for rewrites using RewriteBase /development/ sending everything to /development/index.php where the request is not a file or directory.
Give the following a try:
/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^development/?
RewriteRule . /index.php [L]
</IfModule>
/development/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /development/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /development/index.php [L]
</IfModule>
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