htaccess in root and subdirectory
-
I have read lots of helpful information about this, but am still unclear on some matters.
WordPress has been installed in its own directory /wordpress and the website address was originally test.pat.gen.nz/wordpress
/wordpress/index.php includes statement:
require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );I use pretty permalinks, so /wordpress/.htaccess comprises:
# 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 WordPressIn order to change the url of my website to test.pat.gen.nz (leaving WordPress in its subdirectory), I copied (not moved) the above two files to the root, modifying them as follows:
index.php:
require( dirname( __FILE__ ) . ‘/wordpress/wp-blog-header.php’ );.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 WordPressIt all works as expected, so I am probably worrying over nothing, but I just want to be sure that I am correct in leaving the two files in /wordpress.
As an aside, I understand that htaccess intercepts a call to test.pat.gen.nz/map and routes the request to test.pat.gen.nz/index.php. How does WordPress know that the intended page was ‘map’? Again, I probably do not delve too deeply into things which work perfectly well!
Regards
Andy
- The topic ‘htaccess in root and subdirectory’ is closed to new replies.