0

私は次のURLを持っています: www.domain.com.au/--xyz-75/

このURLをホームページにリダイレクトする方法、つまりwww.domain.com.au.htaceesを使用する方法を提案してください。

public_htmlフォルダー内の.htaccessファイル。

アプリケーションはphpで開発されています。

.htaccessでそれが不可能な場合、他の方法はありますか?

4

5 に答える 5

1

他の回答と併せて、この解決策を機能させるには、書き換えエンジンをオンにする必要があります。

RewriteEngine on
Redirect /--xyz-75/index.php http://www.domain.com.au/

もう 1 つの方法は、www.domain.com.au/--xyz-75/フォルダー内の index.html (または index.php) ファイルで単純な HTML コードを使用することです。

<meta http-equiv="refresh" content="1;URL=http://www.domain.com.au/" />
于 2012-09-24T07:06:08.330 に答える
1

.htaccess ファイルに次のコード行を追加してみましたか:

Redirect 301 /--xyz-75/ /

これは単にあなたのURLからあなたの例では「www.domain.com.au」であるルートにリダイレクトします。

于 2014-07-29T11:24:57.473 に答える
0

この解決策を試してください:

RewriteEngine On 
#if requested filename is not a existing file
RewriteCond %{REQUEST_FILENAME} !-f
#if requested filename is not a existing directory
RewriteCond %{REQUEST_FILENAME} !-d 
#Rewrite the url
RewriteRule ^--([^/]+)/?$ http://example.com [R,L]

これはリダイレクトします:

example.com/--foo 

example.com
于 2015-06-13T02:16:00.420 に答える
0

.htaccess

Redirect /--xyz-75/index.php http://www.domain.com.au/

PHP ファイルには、それを行うための多くのオプションがあります。PHP ヘッダーの場所:

<?php header("Location: http://www.domain.com.au/"); ?>

JS では、JS がユーザーのブラウザーで有効になっている場合にのみ機能するという問題があります。

<script type="text/javascript">
window.location = "http://www.domain.com.au/"
</script>

そしてHTMLで:

<meta http-equiv="REFRESH" content="0;url=http://www.domain.com.au/">
于 2012-09-24T06:43:04.037 に答える
0

.htaccessでこれを試してください

RewriteEngine on    
Redirect /--xyz-75/ http://www.domain.com.au/
于 2012-09-24T06:44:10.527 に答える