صفحه 1 از 2 12 آخرینآخرین
نمایش نتایج: از شماره 1 تا 10 , از مجموع 11

موضوع: چگونه اجرای htaccess بر روی کل سرور؟

  1. #1
    عضو دائم asrhosting آواتار ها
    تاریخ عضویت
    Sep 2009
    محل سکونت
    ایالات نصر آباد جرقویه
    نوشته ها
    1,110
    تشکر تشکر کرده 
    564
    تشکر تشکر شده 
    2,405
    تشکر شده در
    1,448 پست

    پیش فرض چگونه اجرای htaccess بر روی کل سرور؟

    با سلام .
    نیاز داریم تعدادی کد بر روی .htaccess کل سایت های روی سرور اجرا بشه.
    آیا میشه از سرور ( root ) این دستور رو داد که کل سایت ها به علاوه اون htaccess که دارن محتویات ما هم بهشون اضافه بشه ؟
    میزبانی هاست لینوکس و ویندوز | نمایندگی دایرکت ادمین ، سی پنل ، پلسک روی سرورهای ایران
    ارائه سرور مجازی از ایران با پهنای باند نامحدود و لایسنس رایگان دایرکت ادمین ، سی پنل ، پلسک

  2. # ADS




     

  3. #2
    عضو دائم asrhosting آواتار ها
    تاریخ عضویت
    Sep 2009
    محل سکونت
    ایالات نصر آباد جرقویه
    نوشته ها
    1,110
    تشکر تشکر کرده 
    564
    تشکر تشکر شده 
    2,405
    تشکر شده در
    1,448 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    از دوستان کسی اطلاعی داره؟
    میزبانی هاست لینوکس و ویندوز | نمایندگی دایرکت ادمین ، سی پنل ، پلسک روی سرورهای ایران
    ارائه سرور مجازی از ایران با پهنای باند نامحدود و لایسنس رایگان دایرکت ادمین ، سی پنل ، پلسک

  4. #3
    عضو دائم asrhosting آواتار ها
    تاریخ عضویت
    Sep 2009
    محل سکونت
    ایالات نصر آباد جرقویه
    نوشته ها
    1,110
    تشکر تشکر کرده 
    564
    تشکر تشکر شده 
    2,405
    تشکر شده در
    1,448 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    ؟؟؟؟؟؟؟؟
    کسی جوابی نداره ؟
    میزبانی هاست لینوکس و ویندوز | نمایندگی دایرکت ادمین ، سی پنل ، پلسک روی سرورهای ایران
    ارائه سرور مجازی از ایران با پهنای باند نامحدود و لایسنس رایگان دایرکت ادمین ، سی پنل ، پلسک

  5. #4
    عضو انجمن fara_server آواتار ها
    تاریخ عضویت
    Feb 2012
    محل سکونت
    ایران
    نوشته ها
    187
    تشکر تشکر کرده 
    40
    تشکر تشکر شده 
    287
    تشکر شده در
    153 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    با سلام.
    یک اسکریپت پرل نوشتم که کاری که شما میخواهید رو انجام میده.
    -----------
    # اسکریپت رو در داخل یک فایل با پسوند pl. در سرور ذخیره کنید.
    # کد مورد نظرتون رو که در نظر دارید به htaccess. اضافه کنید درداخل کد و به جای : INSERT CODE HERE قرار بدید.
    #برای اجرا از طریق ترمینال : Perl script.pl


    کد:
    #!/usr/bin/env perl
    ########################
    #C0ded by : fara_server
    ########################
    use strict;
    use warnings;
    my $locate = "find -name '.htaccess'";
    my @path = `$locate`;
    chomp @path;
    foreach my $result (@path)
    {
      open FILE,">> $result";
      print FILE"INSERT CODE HERE!";
      close(FILE);
    }
    البته توضیجات برای دوستانی بود که با پرل آشنایی ندارند ، شما استاد ما هستید.
    یا حق
    کانفیگ،امنیت بخشی و راه اندازی انواع سروها با هزینه مناسب | طراحی و برنامه نویسی تحت وب | جهت درخواست از اینجا اقدام نمایید.
    --==--==--==--
    !Linux Geek


  6. تعداد تشکر ها ازfara_server به دلیل پست مفید


  7. #5
    عضو دائم asrhosting آواتار ها
    تاریخ عضویت
    Sep 2009
    محل سکونت
    ایالات نصر آباد جرقویه
    نوشته ها
    1,110
    تشکر تشکر کرده 
    564
    تشکر تشکر شده 
    2,405
    تشکر شده در
    1,448 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    نقل قول نوشته اصلی توسط fara_server نمایش پست ها
    با سلام.
    یک اسکریپت پرل نوشتم که کاری که شما میخواهید رو انجام میده.
    -----------
    # اسکریپت رو در داخل یک فایل با پسوند pl. در سرور ذخیره کنید.
    # کد مورد نظرتون رو که در نظر دارید به htaccess. اضافه کنید درداخل کد و به جای : INSERT CODE HERE قرار بدید.
    #برای اجرا از طریق ترمینال : Perl script.pl


    کد:
    #!/usr/bin/env perl
    ########################
    #C0ded by : fara_server
    ########################
    use strict;
    use warnings;
    my $locate = "find -name '.htaccess'";
    my @path = `$locate`;
    chomp @path;
    foreach my $result (@path)
    {
      open FILE,">> $result";
      print FILE"INSERT CODE HERE!";
      close(FILE);
    }
    البته توضیجات برای دوستانی بود که با پرل آشنایی ندارند ، شما استاد ما هستید.
    یا حق

    سلام .
    خیلی ممنون .
    جناب فرقی نداره این فایل کجای سرور باشه ؟ مثلا home ? .
    موقعی که دستور اخر رو بزنم روی همه سایت ها اعمال میشه ؟ مشکلی با htaccess اونها بوجود نمی یاره ؟
    اگر سایت جدیدی اضافه بشه سیستم خودش اتوماتیک انجام میده یا باید دوباره مراحل اخر رو رفت ؟
    میزبانی هاست لینوکس و ویندوز | نمایندگی دایرکت ادمین ، سی پنل ، پلسک روی سرورهای ایران
    ارائه سرور مجازی از ایران با پهنای باند نامحدود و لایسنس رایگان دایرکت ادمین ، سی پنل ، پلسک

  8. #6
    عضو انجمن fara_server آواتار ها
    تاریخ عضویت
    Feb 2012
    محل سکونت
    ایران
    نوشته ها
    187
    تشکر تشکر کرده 
    40
    تشکر تشکر شده 
    287
    تشکر شده در
    153 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    نقل قول نوشته اصلی توسط asrhosting نمایش پست ها
    سلام .
    خیلی ممنون .
    جناب فرقی نداره این فایل کجای سرور باشه ؟ مثلا home ? .
    موقعی که دستور اخر رو بزنم روی همه سایت ها اعمال میشه ؟ مشکلی با htaccess اونها بوجود نمی یاره ؟
    اگر سایت جدیدی اضافه بشه سیستم خودش اتوماتیک انجام میده یا باید دوباره مراحل اخر رو رفت ؟
    #نه فرقی نداره کجای سرور باشه ، پیشفرض در root ذخیره کنید و اجرا کنید .
    #خیر مشکلی به وجود نمیاد اطلاعات به انتهای فایلهای htaccess. ، اپند میشه.
    #خیر این اسکریپت ساده ای بود که بنا به درخواستی که مطرح کرده بودید نوشتم ، زیاد روش کار نکردم، انشاا.. اگه وقت شد بیشتر روش کار میکنم تا استفاده ازش راحتتر باشه ، اما فعلا با عرض پوزش نمیرسم...
    کانفیگ،امنیت بخشی و راه اندازی انواع سروها با هزینه مناسب | طراحی و برنامه نویسی تحت وب | جهت درخواست از اینجا اقدام نمایید.
    --==--==--==--
    !Linux Geek


  9. تعداد تشکر ها از fara_server به دلیل پست مفید


  10. #7
    عضو دائم asrhosting آواتار ها
    تاریخ عضویت
    Sep 2009
    محل سکونت
    ایالات نصر آباد جرقویه
    نوشته ها
    1,110
    تشکر تشکر کرده 
    564
    تشکر تشکر شده 
    2,405
    تشکر شده در
    1,448 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    انجام دادم ولی ارور داد و ....
    Bareword found where operator expected at fast.pl line 19, near "ExpiresByType image/x-icon "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 19, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 20, near "ExpiresByType text/css ""
    (Might be a runaway multi-line "" string starting on line 19)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 20, near "ExpiresByType text/css "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 20, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 21, near "ExpiresByType text/javascript ""
    (Might be a runaway multi-line "" string starting on line 20)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 21, near "ExpiresByType text/javascript "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 21, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 22, near "ExpiresByType application/x-javascript ""
    (Might be a runaway multi-line "" string starting on line 21)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 22, near "ExpiresByType application/x-javascript "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 22, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 23, near "Header unset Last-Modified""
    (Might be a runaway multi-line "" string starting on line 22)
    (Missing semicolon on previous line?)
    syntax error at fast.pl line 14, near "ExpiresDefault "access plus "
    Execution of fast.pl aborted due to compilation errors.
    root@linux [/home]# perl fast.pl
    Bareword found where operator expected at fast.pl line 14, near "ExpiresDefault "access"
    (Might be a runaway multi-line "" string starting on line 11)
    (Do you need to predeclare ExpiresDefault?)
    Bareword found where operator expected at fast.pl line 14, near "1 year"
    (Missing operator before year?)
    String found where operator expected at fast.pl line 15, near "ExpiresByType text/html ""
    (Might be a runaway multi-line "" string starting on line 14)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 15, near "ExpiresByType text/html "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 15, near "1 second"
    (Missing operator before second?)
    String found where operator expected at fast.pl line 16, near "ExpiresByType image/gif ""
    (Might be a runaway multi-line "" string starting on line 15)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 16, near "ExpiresByType image/gif "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 16, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 17, near "ExpiresByType image/jpeg ""
    (Might be a runaway multi-line "" string starting on line 16)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 17, near "ExpiresByType image/jpeg "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 17, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 18, near "ExpiresByType image/png ""
    (Might be a runaway multi-line "" string starting on line 17)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 18, near "ExpiresByType image/png "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 18, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 19, near "ExpiresByType image/x-icon ""
    (Might be a runaway multi-line "" string starting on line 18)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 19, near "ExpiresByType image/x-icon "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 19, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 20, near "ExpiresByType text/css ""
    (Might be a runaway multi-line "" string starting on line 19)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 20, near "ExpiresByType text/css "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 20, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 21, near "ExpiresByType text/javascript ""
    (Might be a runaway multi-line "" string starting on line 20)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 21, near "ExpiresByType text/javascript "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 21, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 22, near "ExpiresByType application/x-javascript ""
    (Might be a runaway multi-line "" string starting on line 21)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 22, near "ExpiresByType application/x-javascript "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 22, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 23, near "Header unset Last-Modified""
    (Might be a runaway multi-line "" string starting on line 22)
    (Missing semicolon on previous line?)
    syntax error at fast.pl line 14, near "ExpiresDefault "access plus "
    Execution of fast.pl aborted due to compilation errors.
    root@linux [/home]# nano fast.pl
    root@linux [/home]# perl fast.pl
    Bareword found where operator expected at fast.pl line 16, near "ExpiresDefault "access"
    (Might be a runaway multi-line "" string starting on line 11)
    (Do you need to predeclare ExpiresDefault?)
    Bareword found where operator expected at fast.pl line 16, near "1 year"
    (Missing operator before year?)
    String found where operator expected at fast.pl line 17, near "ExpiresByType text/html ""
    (Might be a runaway multi-line "" string starting on line 16)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 17, near "ExpiresByType text/html "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 17, near "1 second"
    (Missing operator before second?)
    String found where operator expected at fast.pl line 18, near "ExpiresByType image/gif ""
    (Might be a runaway multi-line "" string starting on line 17)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 18, near "ExpiresByType image/gif "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 18, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 19, near "ExpiresByType image/jpeg ""
    (Might be a runaway multi-line "" string starting on line 18)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 19, near "ExpiresByType image/jpeg "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 19, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 20, near "ExpiresByType image/png ""
    (Might be a runaway multi-line "" string starting on line 19)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 20, near "ExpiresByType image/png "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 20, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 21, near "ExpiresByType image/x-icon ""
    (Might be a runaway multi-line "" string starting on line 20)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 21, near "ExpiresByType image/x-icon "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 21, near "2592000 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 22, near "ExpiresByType text/css ""
    (Might be a runaway multi-line "" string starting on line 21)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 22, near "ExpiresByType text/css "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 22, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 23, near "ExpiresByType text/javascript ""
    (Might be a runaway multi-line "" string starting on line 22)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 23, near "ExpiresByType text/javascript "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 23, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 24, near "ExpiresByType application/x-javascript ""
    (Might be a runaway multi-line "" string starting on line 23)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at fast.pl line 24, near "ExpiresByType application/x-javascript "access"
    (Do you need to predeclare ExpiresByType?)
    Bareword found where operator expected at fast.pl line 24, near "604800 seconds"
    (Missing operator before seconds?)
    String found where operator expected at fast.pl line 25, near "Header unset Last-Modified""
    (Might be a runaway multi-line "" string starting on line 24)
    (Missing semicolon on previous line?)
    syntax error at fast.pl line 16, near "ExpiresDefault "access plus "
    Execution of fast.pl aborted due to compilation errors.
    میزبانی هاست لینوکس و ویندوز | نمایندگی دایرکت ادمین ، سی پنل ، پلسک روی سرورهای ایران
    ارائه سرور مجازی از ایران با پهنای باند نامحدود و لایسنس رایگان دایرکت ادمین ، سی پنل ، پلسک

  11. #8
    عضو انجمن fara_server آواتار ها
    تاریخ عضویت
    Feb 2012
    محل سکونت
    ایران
    نوشته ها
    187
    تشکر تشکر کرده 
    40
    تشکر تشکر شده 
    287
    تشکر شده در
    153 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    دقیقا کدی رو که در فایل fast.pl قرار دادید رو اینجا قرار بدید برسی کنم ، من روی CentOS تست کردم بدون هیچ مشکلی کار میکنه!
    احتمالا مشکل از درج کد Htaccess هست که قصد افزودن اون به انتهای فایلها رو داشتید ، من با یک متن ساده تست کردم و به راحتی اعمال شد...
    کانفیگ،امنیت بخشی و راه اندازی انواع سروها با هزینه مناسب | طراحی و برنامه نویسی تحت وب | جهت درخواست از اینجا اقدام نمایید.
    --==--==--==--
    !Linux Geek


  12. #9
    عضو انجمن fara_server آواتار ها
    تاریخ عضویت
    Feb 2012
    محل سکونت
    ایران
    نوشته ها
    187
    تشکر تشکر کرده 
    40
    تشکر تشکر شده 
    287
    تشکر شده در
    153 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    برای راحتی بیشتر کمی تغییر توی اسکریپت ایجاد کردم که کدهای htaccess رو از فایلی در کنارش (code.txt) میخونه.
    کافیه که کد مورد نظر رو درون فایل code.txt ذخیره کنید و بعد از اون اسکریپت رو اجرا کنید...
    %تست شده%

    کد:
    #!/usr/bin/env perl########################
    #C0ded by : fara_server
    ########################
    use strict;
    use warnings;
    my $htcode;
    my $sourcefile="pwd/code.txt";
    my $locate = "find -name '.htaccess'";
    my @path = `$locate`;
    chomp @path;
    if(@path && -e $sourcefile){
    open SFILE,"code.txt";
    my @output=<SFILE>;
    foreach my $result (@path)
    {
      open FILE,">> $result";
      foreach $htcode(@output)
    {
      print FILE $htcode;
    }
    }
    close(SFILE);
    close(FILE);
    print "\n \r DONE!\n";
    }else{
    print "Error - FILE NOT FOUND - somthing is wrong!\r\n";
    exit();
    }
    بازم اگر مشکلی بود اعلام کنید برسی کنم...
    یا حق
    کانفیگ،امنیت بخشی و راه اندازی انواع سروها با هزینه مناسب | طراحی و برنامه نویسی تحت وب | جهت درخواست از اینجا اقدام نمایید.
    --==--==--==--
    !Linux Geek


  13. تعداد تشکر ها ازfara_server به دلیل پست مفید


  14. #10
    عضو دائم asrhosting آواتار ها
    تاریخ عضویت
    Sep 2009
    محل سکونت
    ایالات نصر آباد جرقویه
    نوشته ها
    1,110
    تشکر تشکر کرده 
    564
    تشکر تشکر شده 
    2,405
    تشکر شده در
    1,448 پست

    پیش فرض پاسخ : چگونه اجرای htaccess بر روی کل سرور؟

    ممنون فرا جان .
    فایل باید تو پوشه pwd باشه یا اون pwd برا چه چیز دیگه اس ؟
    اگر بخواییم چند تا httaccess اجرا بشه باید چی کار کرد ؟
    میزبانی هاست لینوکس و ویندوز | نمایندگی دایرکت ادمین ، سی پنل ، پلسک روی سرورهای ایران
    ارائه سرور مجازی از ایران با پهنای باند نامحدود و لایسنس رایگان دایرکت ادمین ، سی پنل ، پلسک

صفحه 1 از 2 12 آخرینآخرین

اطلاعات موضوع

کاربرانی که در حال مشاهده این موضوع هستند

در حال حاضر 1 کاربر در حال مشاهده این موضوع است. (0 کاربران و 1 مهمان ها)

موضوعات مشابه

  1. پاسخ ها: 0
    آخرين نوشته: February 2nd, 2016, 11:55
  2. کد htaccess کش شدن سایت بر روی مرورگر
    توسط web2iran.ir در انجمن دايرکت ادمين DirectAdmin
    پاسخ ها: 0
    آخرين نوشته: July 25th, 2015, 00:58
  3. کار نکردن htaccess در کنترل پنل پلسک 9 روی vps
    توسط mahmoodiii در انجمن پلسک Plesk
    پاسخ ها: 2
    آخرين نوشته: September 2nd, 2014, 15:43
  4. کد htaccess کش شدن سایت بر روی مرورگر
    توسط myserver در انجمن سی پنل CPanel
    پاسخ ها: 2
    آخرين نوشته: August 21st, 2014, 11:35
  5. مشکل در فراخوانی .htaccess در وی پی اس
    توسط slashflash در انجمن مباحث دیگر
    پاسخ ها: 1
    آخرين نوشته: March 26th, 2013, 14:28

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •