I want to set up a setting that does not transfer only certain directories.

Asked 2 years ago, Updated 2 years ago, 93 views

Thank you for your help.
I would like to set up a setting that does not transfer only certain directories, but the following description of htaccess does not work.
I don't transfer only the word press management screen via Sakura Internet.I want to.
Could someone please let me know?

Directory to Exclude:

http://abcd.sakura.ne.jp/shoki2/wp-admin/

The second line below did not work.

RewriteEngine on
RewriteCon%{HTTP_HOST}^abcd\.sakura\.ne\.jp(:80)?$
RewriteCond%{http://abcd.sakura.ne.jp/}!(^/shoki2/wp-admin/)
RewriteRule^(.*)$http://example.com/$1 [R=301,L]

"By the way, ""How to transfer your own domain from the initial domain"" on the Sakura Internet Other question threads, but I created a new thread for additional questions.
Thank you for your cooperation.

Thank you for your reply below.I put htaccess in /shoki2/ and it didn't work, so I put it in /shoki2/wp-admin/ but it didn't work.How exactly should I write that I write after finishing the rules?Could you please let me know?

RewriteRule^/shoki2/wp-admin/-[L]

.htaccess

2022-09-30 19:50

3 Answers

RewriteEngine on
RewriteCon%{HTTP_HOST}^abcd\.sakura\.ne\.jp(:80)?$
RewriteCond%{REQUEST_FILENAME}!^/shoki2/wp-admin/
RewriteRule^(.*)$http://example.com/$1 [R=301,L]

That would be fine.


2022-09-30 19:50

It may have already been resolved, but if you want to permanently transfer to a new domain (proprietary domain) and only "do not transfer" a specific directory, why not place .htaccess in the document root (/) with the following rules?
(It's almost the same as @suzukis...)

RewriteEngine On
RewriteBase/
RewriteCond%{REQUEST_URI}!(^/shoki2/wp-admin/)
RewriteRule^$ http://example.com/ [R=301,L]

Also, once you finish the rule, I think writing means specifying L in the option [] that you want to add to the end of RewriteRule.
This option [L] means that if the conditions are met, the decision will end there (that is, it will not evaluate the RewriteRule that follows).

Therefore, by bringing this option to the beginning of a set of rules, URLs that match the rule can exit without reaching the transfer process and exclude the specified URL access from the transfer configuration.

RewriteEngine On
RewriteBase/
RewriteRule^/shoki2/wp-admin/-[L]
RewriteRule^/shoki2/test1/http://example.co.jp/test1/ [R=301,L]
RewriteRule^/shoki2/test2/http://example.co.jp/test2/ [R=301,L]
RewriteRule^/shoki2/test3/http://example.ne.jp/test3/ [R=301,L]
RewriteRule^/shoki2/test4/http://example.ne.jp/test4/ [R=301,L]
RewriteRule^/(.*)$http://example.com/$1 [R=301,L]


2022-09-30 19:50

At the beginning

RewriteRule^/shoki2/wp-admin/-[L]

After you finish the rule in , you might want to set the transfer rule.


2022-09-30 19:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.