2017-10-17 12 views
1

나는이 URL로 리디렉션 리디렉션 스크립트가.htaccess 파일에서 URL 재 작성을 설정하는 방법은 무엇입니까?

http://my-domain.com/URL.php?url=http://www.google.com

내가

http://my-domain.com/?url=http://www.google.com

또는

로 URL을 다시 작성하려면

http://my-domain.com/?http://www.google.com 16,나는이 함께 할 수있는 htaccess로 그래서 내가 어떤 코드 나 자신을 시도 알고있다. 내 웹 디렉토리에 .htaccess 파일을 생성하고 난 몇 가지 코드 예를 들어 넣어 :

# Prevent Apache from serving .ht* files: 
<FilesMatch "^\.ht"> 
Order allow,deny 
Deny from all 
</FilesMatch> 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^www.my-domain.com$ [NC] 
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L] 
RewriteRule ^embed/([^\.]+)\.php$ /$1 [L] 
RewriteRule URL.php/

을하지만 여전히 내가이 일을하려고 여기

+0

'php'태그가 필요하지 않다고 생각합니다. – GrumpyCrouton

답변

2

잘못하고 있어요 무슨, 작동하지 않습니다.

RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^url/(.*)$ /URL.php?url=$1 [L] 

예 : http://yoursite.com/url/http://www.google.com

또는

RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^go/(.*)$ /URL.php?url=$1 [L] 

예 : http://yoursite.com/go/http://www.google.com

그것을 이런 식으로 사용하는 것이 좋을 것이다.

+0

둘 다 "403 Forbidden"오류를 표시합니다. –

+0

Get 매개 변수를 추가하는 것을 잊었습니다. 나는 그것이 효과가 있기를 바란다. 이제 시도해 볼 수 있습니다. –

+0

및 RewriteBase가 추가되었습니다. –

관련 문제