eGospodarka.pl
eGospodarka.pl poleca

eGospodarka.plGrupypl.comp.www › usuwanie index.php z URL
Ilość wypowiedzi w tym wątku: 5

  • 1. Data: 2016-10-04 09:22:22
    Temat: usuwanie index.php z URL
    Od: Jivanmukta <j...@p...onet.pl>

    Mam aplikację PHP (CodeIgniter) z plikiem startowym
    ~robert/public_html/index.php
    Próbuję usunąć nazwę pliku z URL, tzn. np. zamiast
    http://localhost/~robert/index.php/admin (to mi działa) chciałbym mieć
    http://localhost/~robert/admin (to mi jeszcze nie działa).
    Zrobiłem tak (wg informacji z Internetu):

    W katalogu ~robert/public_html mam plik .htaccess o treści:

    #v+

    AuthUserFile "/home/robert/application/resources/.htpass"
    AuthName "Strony zabezpieczone"
    AuthType Basic
    require valid-user

    ErrorDocument 401 "/home/robert/public_html/denial.html"

    DirectoryIndex index.php

    RewriteEngine on
    RewriteBase /~robert/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|robots\.txt|denial\.html|resources|cap
    tcha)
    RewriteRule ~(.*)$ /index.php/$1 [L,QSA]

    php_value upload_max_filesize 10M
    php_value post_max_size 70M

    #v-

    Plik ma atrybuty: -rw-rw---- 1 robert www-data 531 paź 4 08:44 .htaccess
    Katalog ~robert/public_html ma atrybuty: drwxrwx--- 6 robert www-data 4096
    paź 3 17:57 ./
    Pracuję pod Linux Mint 17.3 Rosa z Apache Server version: Apache/2.4.7

    Problem w tym, że przy próbie otwarcia http://localhost/~robert/admin mam
    błąd: Not Found The requested URL /~robert/admin/ was not found on this
    server. Nie wiem co jest źle.

    error.log Apache'a zawiera:
    [Tue Oct 04 06:09:04.018435 2016] [so:warn] [pid 1643] AH01574: module
    mono_module is already loaded, skipping
    [Tue Oct 04 06:09:04.062335 2016] [:error] [pid 1649] Failed running
    '/usr/bin/mod-mono-server2 --filename /tmp/mod_mono_server_global --nonstop
    --master (null) (null) (null) (null) (null) (null) (null) (null)'. Reason:
    No such file or directory
    [Tue Oct 04 06:09:04.092888 2016] [mpm_prefork:notice] [pid 1645] AH00163:
    Apache/2.4.7 (Ubuntu) mod_mono/2.11 PHP/5.5.9-1ubuntu4.19 configured --
    resuming normal operations
    [Tue Oct 04 06:09:04.092959 2016] [core:notice] [pid 1645] AH00094: Command
    line: '/usr/sbin/apache2'
    Listening on: /tmp/.mod_mono_server4
    Root directory: /

    access.log Apache'a zawiera:
    localhost - Robert [04/Oct/2016:08:04:42 +0200] "GET /~robert/admin/
    HTTP/1.1" 404 502 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0)
    Gecko/20100101 Firefox/48.0"
    localhost - Robert [04/Oct/2016:08:12:57 +0200] "GET /~robert/admin/
    HTTP/1.1" 404 502 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0)
    Gecko/20100101 Firefox/48.0"
    localhost - Robert [04/Oct/2016:08:28:32 +0200] "GET /~robert/admin/
    HTTP/1.1" 404 502 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0)
    Gecko/20100101 Firefox/48.0"
    localhost - Robert [04/Oct/2016:08:28:38 +0200] "GET /~robert/ HTTP/1.1" 200
    9136 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101
    Firefox/48.0"
    localhost - Robert [04/Oct/2016:08:28:39 +0200] "GET
    /~robert/captcha/1475562519.7357.jpg HTTP/1.1" 200 2766
    "http://localhost/~robert/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64;
    rv:48.0) Gecko/20100101 Firefox/48.0"
    localhost - Robert [04/Oct/2016:08:28:44 +0200] "GET /~robert/admin/
    HTTP/1.1" 404 501 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0)
    Gecko/20100101 Firefox/48.0"
    localhost - - [04/Oct/2016:08:44:18 +0200] "GET /~robert/admin/ HTTP/1.1"
    404 847 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101
    Firefox/48.0"
    localhost - Robert [04/Oct/2016:08:44:19 +0200] "GET /~robert/admin/
    HTTP/1.1" 404 501 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0)
    Gecko/20100101 Firefox/48.0"
    localhost - - [04/Oct/2016:08:44:19 +0200] "GET /favicon.ico HTTP/1.1" 404
    498 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101
    Firefox/48.0"
    localhost - Robert [04/Oct/2016:08:44:31 +0200] "GET /~robert/admin/
    HTTP/1.1" 404 502 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0)
    Gecko/20100101 Firefox/48.0"


  • 2. Data: 2016-10-04 23:36:50
    Temat: Re: usuwanie index.php z URL
    Od: Borys Pogoreło <b...@p...edu.leszno>

    Dnia Tue, 04 Oct 2016 09:22:22 +0200, Jivanmukta napisał(a):

    > RewriteRule ~(.*)$ /index.php/$1 [L,QSA]

    Zacznij od poprawienia tego powyżej na ^(.*)$

    --
    Borys Pogoreło
    borys(#)leszno,edu,pl


  • 3. Data: 2016-10-05 08:28:02
    Temat: Re: usuwanie index.php z URL
    Od: Jivanmukta <j...@p...onet.pl>

    Borys Pogoreło wrote:

    > Dnia Tue, 04 Oct 2016 09:22:22 +0200, Jivanmukta napisał(a):
    >
    >> RewriteRule ~(.*)$ /index.php/$1 [L,QSA]
    >
    > Zacznij od poprawienia tego powyżej na ^(.*)$
    >

    Dzięki.
    Teraz mam:

    [Wed Oct 05 07:26:36.514786 2016] [:error] [pid 1669] [client ::1:49901]
    script '/var/www/html/index.php' not found or unable to stat
    [Wed Oct 05 07:38:05.712066 2016] [core:crit] [pid 1672] (13)Permission
    denied: [client ::1:49937] AH00529: /home/robert/public_html/.htaccess
    pcfg_openfilek:: unable to check htaccess file, ensure it is readable and
    that '/home/robert/public_html/' is executable

    W .htaccess mam: RewriteBase /~robert/
    Problem się zrobił jak bawiłem się .htaccess i zupgradowałem Linuxa Mint.
    Mój .htaccess ma atrybuty -rw-rw---- 1 robert robert 530 paź 5 07:49
    Mój userdir.conf wygląda tak:

    <IfModule mod_userdir.c>
    UserDir public_html
    UserDir disabled root

    <Directory /home/*/public_html>
    AllowOverride All
    Options ExecCGI
    # AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch
    IncludesNoExec
    <Limit GET POST OPTIONS>
    Order allow,deny
    Allow from all
    # Require all granted
    </Limit>
    <LimitExcept GET POST OPTIONS>
    Order deny,allow
    Deny from all
    # Require all denied
    </LimitExcept>
    </Directory>
    </IfModule>

    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

    Pomóż proszę, obiecuję że już się nie będę bawił .htaccess...


  • 4. Data: 2016-10-05 09:56:22
    Temat: Re: usuwanie index.php z URL
    Od: Wojtek Gapiński <w...@w...I.TO.TEZ.pl>

    W dniu 05-10-2016 o 08:28, Jivanmukta pisze:
    > Borys Pogoreło wrote:
    >
    >> Dnia Tue, 04 Oct 2016 09:22:22 +0200, Jivanmukta napisał(a):
    >>
    >>> RewriteRule ~(.*)$ /index.php/$1 [L,QSA]
    >>
    >> Zacznij od poprawienia tego powyżej na ^(.*)$
    >>
    >
    > Dzięki.
    > Teraz mam:
    >
    > [Wed Oct 05 07:26:36.514786 2016] [:error] [pid 1669] [client ::1:49901]
    > script '/var/www/html/index.php' not found or unable to stat
    > [Wed Oct 05 07:38:05.712066 2016] [core:crit] [pid 1672] (13)Permission
    > denied: [client ::1:49937] AH00529: /home/robert/public_html/.htaccess
    > pcfg_openfilek:: unable to check htaccess file, ensure it is readable and
    > that '/home/robert/public_html/' is executable
    >
    > W .htaccess mam: RewriteBase /~robert/
    > Problem się zrobił jak bawiłem się .htaccess i zupgradowałem Linuxa Mint.
    > Mój .htaccess ma atrybuty -rw-rw---- 1 robert robert 530 paź 5 07:49

    IMHO tu jest właśnie problem, zresztą masz to w komunikacie o błędzie.
    .htaccess powinien mieć dostęp do odczytu dla grupy i innych
    (-rw-r--r--), chyba że proces Apache'a jest uruchamiany jako Twój
    użytkownik.

    pozdrawiam
    Wojtek




  • 5. Data: 2016-10-05 10:12:21
    Temat: Re: usuwanie index.php z URL
    Od: Jivanmukta <j...@p...onet.pl>

    Wojtek Gapiński wrote:
    > IMHO tu jest właśnie problem, zresztą masz to w komunikacie o błędzie.
    > .htaccess powinien mieć dostęp do odczytu dla grupy i innych
    > (-rw-r--r--), chyba że proces Apache'a jest uruchamiany jako Twój
    > użytkownik.

    Zrobiłem sudo chgrp www-data .htaccess i jest OK.
    Dzięki.

strony : [ 1 ]


Szukaj w grupach

Szukaj w grupach

Eksperci egospodarka.pl

1 1 1

Wpisz nazwę miasta, dla którego chcesz znaleźć jednostkę ZUS.

Wzory dokumentów

Bezpłatne wzory dokumentów i formularzy.
Wyszukaj i pobierz za darmo: