1

I've been trying to configure my .htaccess file to get the following result:

When a parameter (in this case an email) is passed with a forward slash "/" my index.php file will get this parameter. But i think there is something wrong.

The correct way to call the method: http://localhost.com/method/[email protected]

The way without the .htaccess: http://localhost.com/method/[email protected]

But even with when i configure the .htaccess:

<ifmodule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^.]+)/?$ index.php?email=$1 [QSA,L] 
</ifmodule>

The following error occurs:

Not Found The requested URL localhost/method/[email protected] was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Am i missing something in the .htaccess file?

Thanks in advance.

1 Answer 1

3

Your rule stipulates that any match must not contain ..

RewriteRule ^([^.]+)/?$ index.php?email=$1 [QSA,L] 

Yet obviously an e-mail address contains ..

Try:

RewriteRule ^([^/]+)/?$ index.php?email=$1 [QSA,L] 
Sign up to request clarification or add additional context in comments.

1 Comment

Yeaaah. Thanks @Utkanos :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.