הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   שאלה | הפניה באמצעות .htaccess (https://hosts.co.il/forums/showthread.php?t=71079)

SmartSeo 12-01-09 20:47

שאלה | הפניה באמצעות .htaccess
 
קובץ ה- .htaccess שלי מכיל את הנתונים הבאים:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^site.com [nc]
rewriterule ^(.*)$ http://www.site.com/$1 [r=301,nc]

הנ"ל מפנה את הכתוב מsite.com לwww.site.com/


אני מעוניין להוסיף גם הפניה מ site.com/forum
ל forum.site.com

איך צריך הקוד להיראות?
תודה לעוזרים.

vadimg88 12-01-09 21:18

נסה את זה:

קוד:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^site.com$ [nc]
rewriterule ^(.*)$ http://www.site.com/$1 [r=301,nc]

rewritecond %{http_host} ^site.com/forum [nc]
rewriterule ^(.*)$ http://forum.site.com/$1 [r=301,nc]


SmartSeo 12-01-09 21:48

תודה רבה.

SmartSeo 12-01-09 21:52

לא עובד...
להלן הקוד המדויק שהעליתי
ציטוט:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^serv4free.com [nc]
rewriterule ^(.*)$ http://www.serv4free.com/$1 [r=301,nc]

rewritecond %{http_host} ^serv4free.com/forum [nc]
rewriterule ^(.*)$ http://forum.3gb.co.il/$1 [r=301,nc]
הסוגריים בקובץ תקינים (פה הוא לא מציג את זה טוב כ"כ

null 13-01-09 07:31

נסה את זה:

קוד:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^site.com$ [nc]
rewriterule ^(.*)$ http://www.site.com/$1 [r=301,nc]

rewritecond %{http_host} ^http://www.site.com/forum [nc]
rewriterule ^(.*)$ http://forum.site.com/$1 [r=301,nc]


SmartSeo 13-01-09 10:58

Nope
ניסיתי גם את זה, ההפניה לא מתבצעת..
יש למישהו רעיון?

vadimg88 13-01-09 11:12

הקוד הנ"ל עבד לי יופי כרגע בשרת המקומי שלי:

קוד:

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

rewritecond %{http_host} ^devserver.com$ [nc]
rewriterule ^(.*)$ http://www.devserver.com/$1 [r=301,nc]

rewritecond %{http_host} ^devserver.com/forum [nc]
rewriterule ^(.*)$ http://forum.devserver.com/$1 [r=301,nc]


SmartSeo 13-01-09 11:39

תודה על העזרה..
עדיין לא עובד לי..
רק החלק הראשון של הפניה site.com למצב של www.site.com עובד נכון לעכשיו
מה התוספת הזאת אומרת? "IndexIgnore */*?

vadimg88 13-01-09 11:45

צודק, זה לא פשוט כמו שזה נשמע. האם forum.site.com הסאב דומיין הזה קיים בכלל? אם לא צריך להגדיר את זה בתור virtual sub domain .
האם השרת רץ על וינדוס או לינוקס?

"IndexIgnore ימנע מאנשים לגשת לתיקיה הראשית בה ה htaccess נמצא ולצפות בכל התקיות והקבצים.
http://httpd.apache.org/docs/1.3/mod...ml#indexignore

SmartSeo 13-01-09 11:48

להלן הקוד המלא שאני מנסה לשכתב
הסאב דומיין קיים ויש בעיה של תוכן משוכפל ולכן ההפניה
ציטוט:

Options +FollowSymlinks
IndexIgnore */*
RewriteEngine on
rewritecond %{http_host} ^serv4free.com [nc]
rewriterule ^(.*)$ http://www.serv4free.com/$1 [r=301,nc]

rewritecond %{http_host} ^serv4free.com/forum [nc]
rewriterule ^(.*)$ http://forum.3gb.co.il/$1 [r=301,nc]
האתר רץ על שרת לינוקס.
אגב האם htaccess פועל גם על ווינדוס? אם לא מה החלופה שלו?

vadimg88 13-01-09 11:53

זה יהיה ניחוש אבל נסה לשנות את הסדר של ה rules
ואיזה שרת אתה מריץ וינדוס או לינוקס?


קוד:

Options +FollowSymlinks
IndexIgnore */*
RewriteEngine on

rewritecond %{http_host} ^serv4free.com/forum [nc]
rewriterule ^(.*)$ http://forum.3gb.co.il/$1 [r=301,nc]

rewritecond %{http_host} ^serv4free.com [nc]
rewriterule ^(.*)$ http://www.serv4free.com/$1 [r=301,nc]


SmartSeo 13-01-09 12:02

שיניתי את הסדר. עדיין לא מפנה
השרת עליו רץ האתר הוא שרת לינוקס

vadimg88 13-01-09 12:05

יש אפשרות לקבל את ה error_log של apache ? (רק כמה שורות אחרונות שנוספו)

SmartSeo 13-01-09 12:07

?

vadimg88 13-01-09 12:10

בתיקיה של apache/logs בשרת.

SmartSeo 13-01-09 12:38

שלחתי לך את השגיאות
תודה על העזרה..

vadimg88 13-01-09 12:58

טוב ניסיון נוסף תחליף הכל בזה:

קוד:


Options -Indexes +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^serv4free.com [NC]
RewriteRule ^(.*)$ http://www.serv4free.com/$1 [L,R=301]


RedirectMatch 301 ^/forum/(.*)$ http://forum.3gb.co.il/$1


SmartSeo 13-01-09 13:32

מצויין, עובד.
תודה רבה


כל הזמנים הם GMT +2. הזמן כעת הוא 04:47.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ