I am trying to redirect it by writing it in .htaccess
.
The directory configuration is as follows, and the URL is accessible by /site/aaa
or /site/bbb
.
site
└-- aaaa directory
└-- bbbb directory
site
I want the following to be the document root and the URL to be accessible as /aaaa
and /bbb
as well/
to be able to access /aaa
even if I access /aaaa/
or /
, transition to /aaaa/
properly/aaaa
transitions to /site/aaaa/
That's why I'm in trouble.Could you please let me know who it is?
RewriteEngine on
RewriteBase/
RewriteCond%{REQUEST_URI}^/$[OR]
RewriteRule^$aaa/[R=301,L]
RewriteCond%{REQUEST_URI}!/site/
RewriteRule^(.*)$site/$1[L]
Also, conoha Wing was used and the document route could not be specified in httpd.conf.
I would appreciate it if you could give me your advice if there is any other way like the above.
I'm sorry to ask this question from a beginner, but I appreciate your cooperation.
After converting (/aaaa→/site/aaaa) in the last RewriteRule, you will be redirected to add a tracking slash.
Before that, I think it would be good to insert a rule (/aaaa→/aaaa/) to attach a tracking slash.
RewriteRule^$aaa/[R=301,L]
RewriteRule^(aaaa|bbbb)$1/[R=301,L]
RewriteCond%{REQUEST_URI}!/site/
RewriteRule^(.*)$site/$1[L]
© 2024 OneMinuteCode. All rights reserved.