몇 가지 유사한 질문을 찾았지만 대답에서 파악할 수 없거나 직접적으로 내 필요와 일치하지 않습니다.htaccess 하위 도메인으로 리디렉션하고 문자열을 유지
나는 최근에로 사용 그래서 다른 서버에 하위 도메인에 내 사이트의 일부를 이동 : http://mysite.com/clients
사용 http://clients.mysite.com
에 지금
은 무엇을 달성하려고하는 것은 이것이다 : RedirectMatch 301 https?://mysite.com/clients/^(.*)$ https://clients.mysite.com/$1
은 단순히 http://mysite.com/clients
을 타격하는 사람들을 새 하위 도메인으로 리디렉션하는 데 적합하지만/clients/
과 같은 문자열을 유지할 수 있기를 원합니다. 예를 들어 누군가가 http://mysite.com/clients/could_be_a_number_of_things.php
리디렉션 됨 http://clients.mysite.com/could_be_a_number_of_things.php
누구든지 조언을 줄 수 있습니까?
의 요청에 따라전체의 .htaccess :
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
#AuthName mysite.com
#AuthUserFile /home/inhost/public_html/_vti_pvt/service.pwd
#AuthGroupFile /home/inhost/public_html/_vti_pvt/service.grp
# BEGIN WordPress
Options +FollowSymLinks -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTPS}s on(s)|
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$
RewriteRule ^clients/(.*)$ http%1://clients.mysite.com/$1 [L,NC,R=301]
</IfModule>
# END WordPress
그것은 리디렉션처럼 보인다 꽤 괜찮지 만 나는 아파치 설정 전문가가 아니다. 나는'^ (. *) $'가 이전에 어떤 호스트 명과도 일치하지 않는다는 것을 알았다. * 문자열 시작을 의미하는 캐럿 '^'을 제거하십시오. 어쩌면 그것은 후행 URL 경로를 정확하게 일치시킬 것입니다. –
동일한 결과를 얻으려고했는데 (현재 RedirectMatch 301^https ?:, /inceptionhosting.com/clients/ (. *) $ https://clients.inceptionhosting.com/$1 추천을 기반으로 사용하고 있습니다. – user1190083