1

訪問者が私のサイトにアクセスして投稿を読むと、アドレス バーに次のように表示されます。
http://www.example.com/darkalfx/?p=71

アドレスバーにこれを表示するようにURLをマスクするにはどうすればよいですか:
http://www.example.com/?p=71

基本的に、そのサブディレクトリ内のページを URL なしで表示したいだけです/darkalfx/

これは、これまでの.htaccessにあるものです
# Externally redirect only direct client requests for /index.php and
# /index.html and /index.htm with /darkalfx to root URL ending with slash.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /darkalfx/([^/]+/)*index\.(html?|php)\ HTTP/
RewriteRule ^darkalfx/(([^/]+/)*)index.(html?|php)$ http://www.example.com/$1 [R=301,L]

# Externally redirect only direct client requests for /darkalfx<something>
# to www.example.com/<something>.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /darkalfx([^\ ]+)\ HTTP/
RewriteRule ^darkalfx(.*) http://www.example.com/$1 [R=301,L]

# Externally redirect only direct client requests for /index.php
# and /index.html and /index.htm to URL ending with slash.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html?|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index.(html?|php)$ http://www.example.com/$1 [R=301,L]

# Externally redirect to canonicalize the domain name if a non-canonical
# hostname is requested, in order to prevent duplicate-content problems
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

# Internally rewrite requests for www.example.com/<anything>
# to internal server path at /darkalfx/<anything>
RewriteCond %{REQUEST_URI} !^/darkalfx
RewriteRule (.*) /darkalfx/$1 [L]

4

1 に答える 1

0

リンク: htaccess を使用してフォルダー名をマスクする

答え:

    RewriteCond %{THE_REQUEST} ^GET\ /foo/
    RewriteRule ^foo/(.*)$ bar/$1 [R,L]
    RewriteRule ^bar/(.*)$ foo/$1

あなたの場合、 ^bar は home または prob になります / I have no .htacess exp

于 2013-05-23T01:43:49.143 に答える