I know this question has been asked many times, but I still not sure whether I have this correct.
I am trying to make it so that my login page is here:
www.url.com/login
My WordPress installation is contained within a subfolder of my webserver called ‘Main’ (I have already followed these instructions and it is working fine).
Here is how I have set up my two .htaccess files.
The first one, which is located in the /main folder is:
RewriteRule ^login$ wp-login.php [NC,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /main/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /main/index.php [L]
</IfModule>
# END WordPress
The second one is located in the root directory:
# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
RewriteBase /main/
RewriteRule ^login$ /main/wp-login.php [L]
# 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
Lines 3 and 4 are my answer to doing the rewrite while being able to use a relative address for what I am rewriting.
The issue is – I am pretty new at this stuff and I could not find information on someone doing this exact thing, so I basically just guessed this answer. It seems to work, but is this the correct way of doing it?
More importantly, is there a way of replicating this process programatically in WordPress?