.htaccess configs for website installed in subfolder

[ad_1]

Hello, I found 2 example about changing wp directory as below.

one from [https://www.ecenica.com/support/answer/how-to-change-my-document-root-to-a-folder-using-htaccess/])

RewriteEngine on

RewriteCond %{HTTP\_HOST} \^example.com$ \[NC,OR\]

RewriteCond %{HTTP\_HOST} \^www.example.com$

RewriteCond %{REQUEST\_URI} !directory/

RewriteRule (.\*) /directory/$1 \[L\]

​

the other from [https://wordpress.org/support/article/giving-wordpress-its-own-directory/]) (method I)

<IfModule mod\_rewrite.c>

RewriteEngine on

RewriteCond %{HTTP\_HOST} \^(www.)?example.com$

RewriteCond %{REQUEST\_URI} !\^/my\_subdir/

RewriteCond %{REQUEST\_FILENAME} !-f

RewriteCond %{REQUEST\_FILENAME} !-d

RewriteRule \^(.\*)$ /my\_subdir/$1

RewriteCond %{HTTP\_HOST} \^(www.)?example.com$

RewriteRule \^(/)?$ my\_subdir/index.php \[L\]

</IfModule>

&#x200B;

So, my questions is which config is better?

Is the config from WP documents only applied for WP sites and not other php CMS sites like Drupal or Joomla?

[ad_2]
1 Comment
  1. I’ve tried the first config and it get 403 error in one host, in another host it works ok.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer