문제

I've been working on my htaccess file to allow rewritten URL paths and everything works fine on my Localhost but when I upload it to the server and type in the url I get a 404 saying:

The requested URL /** was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I've tried to ask my hosting account support team but they say they can't help with this type of problem. My htaccess code is:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^issue=(.*?)&edition=(.*?)&id=(.*?)&title=(.*?)$
RewriteRule ^article.php$ /article/%1/%2/%3/%4 [L,R]

And an example url is:

http://mywebsite.co.uk/article/1/leeds/1394216062/jupiter-falls-to-tour-with-syron-vanes-and-rdc

Why am I getting the 404 & how can I sort this?

도움이 되었습니까?

해결책

You seem to have written the reverse rule. Try this:

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteRule ^article/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /article.php?issue=$1&edition=$2&id=$3&title=$4 [L,QSA,NC]

This will handle: /article/1/leeds/1394216062/jupiter-falls-to-tour-with-syron-vanes-and-rdc URLs.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top