2

I want to pass a url parameters like example.com/username or example.com/myemail@gmail.com i want to match two condition if anyone is true to select from table? Here's my .htaccess code

 # Default index page
 DirectoryIndex index.php


 # Remove file extensions
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteEngine on

 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME}\.php -f
 RewriteRule ^(.*)$ $1.php

 # Display a custom error message
 #ErrorDocument 404 http://localhost//
 #ErrorDocument 500 http://localhost//

 #ErrorDocument 404  404
 #ErrorDocument 500  500
 #Profile rewrite
 RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?ref=$1
Sahil Gulati
  • 15,028
  • 4
  • 24
  • 42
  • any error you are getting now? – Sagar V Mar 28 '17 at 11:31
  • Your question is completely unclear. _What_ two conditions? And what do you mean by "select from table" in a rewriting context? – arkascha Mar 28 '17 at 11:32
  • 2
    And why first `RewriteCond` and then `RewriteEngine on`? – syck Mar 28 '17 at 11:34
  • You may also want to have look at http://stackoverflow.com/questions/9153262/tips-for-debugging-htaccess-rewrite-rules – syck Mar 28 '17 at 11:36
  • If I understand your intention, you would get from _example.com/abc_ first _/abc.php_ and then _/index.php?ref=abc.php_. However, _example.com/abc@def.gh_ will be rewitten to _/abc@def.gh.php_, since the second rule does only accept letters, numbers, underscore and hyphen. – syck Mar 28 '17 at 11:42
  • I want to get the user input from URL and check my table column name e.g. Users can choose to type in their username or email. From my current script username is working fine but when I type in email it shows error server not fine. – Ibidun Olayinka Mar 28 '17 at 13:20

0 Answers0