Run Wordpress in Directory & Sub-Directory:
We have a wordpress site which is runnung in root directory. Now we want to install same site with different database name in subdirectory for testing purpose.
STARTING POINT:
http://www.mywordpress.com /var/www/
http://www.mywordpress.com/foldername /var/www/foldername
Step 1:
Put same code in /var/www/foldername as in /var/www/ . Connect it with new database.
Step 2:
Change .htaccess file in /var/www/foldername as given below
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /foldername/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /foldername/index.php [L]
</IfModule>
# END WordPress
At this point the configuration will not be working because the .htaccess directives at /var/www/.htaccess with be controlling all aspects of the URL so the directives at /var/www/foldername/.htaccess will have no bearing.
Step 3 :
The final step is to modify the default WordPress htaccess directives so that they will have control in for all variations of the URL.
Now change .htaccess file in /var/www as given below
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^/?foldername/$ /var/www/foldername/index.php [L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Step 4:
Now login to your http://www.mywordpress.com/foldername/wp-admin/ section. Go to Setting->Permalinks.
Choose Post name in common setting.
Thanks
We have a wordpress site which is runnung in root directory. Now we want to install same site with different database name in subdirectory for testing purpose.
STARTING POINT:
http://www.mywordpress.com /var/www/
http://www.mywordpress.com/foldername /var/www/foldername
Step 1:
Put same code in /var/www/foldername as in /var/www/ . Connect it with new database.
Step 2:
Change .htaccess file in /var/www/foldername as given below
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /foldername/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /foldername/index.php [L]
</IfModule>
# END WordPress
At this point the configuration will not be working because the .htaccess directives at /var/www/.htaccess with be controlling all aspects of the URL so the directives at /var/www/foldername/.htaccess will have no bearing.
Step 3 :
The final step is to modify the default WordPress htaccess directives so that they will have control in for all variations of the URL.
Now change .htaccess file in /var/www as given below
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^/?foldername/$ /var/www/foldername/index.php [L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Step 4:
Now login to your http://www.mywordpress.com/foldername/wp-admin/ section. Go to Setting->Permalinks.
Choose Post name in common setting.
Thanks
No comments:
Post a Comment