2017-01-14 9 views
1

예쁜 URL이 나를 위해 작동하지 않는 것 같습니다. 난 여기에 내 공개/디렉토리의 htaccess로 파일을 확인 편집 한 당신이 http://wasamar.com.ng/login을하려고 할 때 그것은하지만 http://wasamar.com.ng/inde.php/login를 찾을 수 없음 (404)의 응답을 제공, 내가 알고있는 모든 것을 시도했다 :예쁜 URL이 laravel5.2에서 작동하지 않습니다.

<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteEngine On 

    # Redirect Trailing Slashes If Not A Folder... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 
</IfModule> 

이를 /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80> 
     # The ServerName directive sets the request scheme, hostname and port that 
     # the server uses to identify itself. This is used when creating 
     # redirection URLs. In the context of virtual hosts, the ServerName 
     # specifies what hostname must appear in the request's Host: header to 
     # match this virtual host. For the default virtual host (this file) this 
     # value is not decisive as it is used as a last resort host regardless. 
     # However, you must set it for any further virtual host explicitly. 

     ServerName wasamar.com.ng 

     ServerAdmin [email protected] 
     DocumentRoot /var/www/html/wasamar/public 

     # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 
     # error, crit, alert, emerg. 
     # It is also possible to configure the loglevel for particular 
     # modules, e.g. 
     #LogLevel info ssl:warn 

     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 

     # For most configuration files from conf-available/, which are 
     # enabled or disabled at a global level, it is possible to 
     # include a line for only one particular virtual host. For example the 
     # following line enables the CGI configuration for this host only 
     # after it has been globally disabled with "a2disconf". 
     #Include conf-available/serve-cgi-bin.conf 
</VirtualHost> 

내가 뭘 잘못하고 있니?

+0

Apache 가상 호스트의 루트 디렉토리는 무엇입니까? –

+0

어디에서 확인할 수 있습니까? 당신이 말하는/etc/apache2입니까? – udemethegrtman

+0

여러분의 OS에 의존합니다. 예를 들어 데비안의 경우'/ etc/apache2/sites-available /'와 같습니다. –

답변

1

아마도 아파치 다시 쓰기 모듈을 사용할 수 없기 때문일 수 있습니다. 우분투 시스템에서 재 작성 모듈을 사용하려면 다음 플랫폼에서 사용할 수 없습니다

sudo a2enmod rewrite 
sudo service apache2 restart 

a2enmod 경우에, 당신은 당신의 httpd.conf 파일을 열고 rewrite_module를 포함한 행의 주석을 해제해야합니다. 이것은 macOS 컴퓨터에서 다음과 같이됩니다 :

LoadModule rewrite_module libexec/mod_rewrite.so 

그런 다음 서비스를 다시 시작해야합니다.

또한 htaccess 파일을 사용하려면 AllowOverride 지시문을 All으로 설정해야합니다. 다음은 예입니다 : 지원을위한

<Directory "/absolute/path/to/webserver/root"> 
    # ... 

    # 
    # AllowOverride controls what directives may be placed in .htaccess files. 
    # It can be "All", "None", or any combination of the keywords: 
    # AllowOverride FileInfo AuthConfig Limit 
    # 
    AllowOverride All 

    # ... 
</Directory> 
+0

나는 이것을 수행했습니다 * ** sudo a2enmod 다시 작성 ***하지만 여전히 문제는 여전히 종료됩니다. – udemethegrtman

0

모두 감사하지만 난이 일이 확정되면 난의 AllowOverride All 섹션에게 dirctory 태그를 추가하지 않은 /etc/apache2/apache2.conf 파일에서 내 오류를 보았다.

+0

그게 내 대답에서 말한거야, 그렇지? – sepehr

+0

그래, 어느 정도까지는 .htaccess라고했지만 .apache2.conf 파일에서 수정했습니다. – udemethegrtman

+0

아니, 나는하지 않았다. 인용하려면 : *'htaccess 파일을 효과적으로 사용하려면 AllowOverride 지시어를 All로 설정해야합니다. '*. – sepehr