Page 1 of 1

Object not found message displayed

PostPosted: 12. May 2016 14:43
by Syam
I have created a htaccess file to rewrite my URL. I have successfully rewrite my URL successfully but the object not found 404 error message displayed. my htaccess file contains


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /file location/
RewriteCond %{QUERY_STRING} name=(.+)
RewriteRule ^index\.php %1? [R=301]
</IfModule>


And my php redirection code is


<?php echo"<script>location.href='index.php?name=username'</script>"; ?>

I want to be my URL like http://www.domainname.com/username can any one help me to solve this issue.

Re: Object not found message displayed

PostPosted: 12. May 2016 21:16
by Nobbie
Look into AccessLog and ErrorLog in order to find out, what is going wrong.

Re: Object not found message displayed

PostPosted: 13. May 2016 14:49
by Syam
I'm submitting the error log and log file here. Can you please help me to solve this issue.

Error log

[Fri May 13 19:11:49.716300 2016] [mpm_winnt:notice] [pid 2648:tid 356] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Fri May 13 19:11:51.744300 2016] [mpm_winnt:notice] [pid 5024:tid 260] AH00364: Child: All worker threads have exited.
[Fri May 13 19:11:51.759900 2016] [mpm_winnt:notice] [pid 2648:tid 356] AH00430: Parent: Child process 5024 exited successfully.
[Fri May 13 19:11:54.947250 2016] [ssl:warn] [pid 2356:tid 356] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri May 13 19:11:55.222250 2016] [ssl:warn] [pid 2356:tid 356] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri May 13 19:11:55.422250 2016] [mpm_winnt:notice] [pid 2356:tid 356] AH00455: Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 configured -- resuming normal operations
[Fri May 13 19:11:55.422250 2016] [mpm_winnt:notice] [pid 2356:tid 356] AH00456: Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
[Fri May 13 19:11:55.422250 2016] [core:notice] [pid 2356:tid 356] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri May 13 19:11:55.423500 2016] [mpm_winnt:notice] [pid 2356:tid 356] AH00418: Parent: Created child process 1400
[Fri May 13 19:11:56.238750 2016] [ssl:warn] [pid 1400:tid 260] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri May 13 19:11:56.437750 2016] [ssl:warn] [pid 1400:tid 260] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri May 13 19:11:56.489750 2016] [mpm_winnt:notice] [pid 1400:tid 260] AH00354: Child: Starting 150 worker threads.


Access log

::1 - - [13/May/2016:19:10:16 +0530] "GET /syam/htaccess/index.php HTTP/1.1" 200 563 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
::1 - - [13/May/2016:19:10:23 +0530] "POST /syam/htaccess/index.php HTTP/1.1" 200 615 "http://localhost/syam/htaccess/index.php" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
::1 - - [13/May/2016:19:10:24 +0530] "GET /syam/htaccess/qwe3 HTTP/1.1" 404 1221 "http://localhost/syam/htaccess/index.php" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
::1 - - [13/May/2016:19:11:21 +0530] "GET /syam/htaccess/index.php HTTP/1.1" 200 603 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
::1 - - [13/May/2016:19:11:22 +0530] "GET /syam/htaccess/index.php?log=out HTTP/1.1" 200 647 "http://localhost/syam/htaccess/index.php" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
::1 - - [13/May/2016:19:11:22 +0530] "GET /syam/htaccess/index.php HTTP/1.1" 200 563 "http://localhost/syam/htaccess/index.php?log=out" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
::1 - - [13/May/2016:19:11:30 +0530] "POST /syam/htaccess/index.php HTTP/1.1" 200 615 "http://localhost/syam/htaccess/index.php" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
::1 - - [13/May/2016:19:11:30 +0530] "GET /syam/htaccess/qwe3 HTTP/1.1" 404 1221 "http://localhost/syam/htaccess/index.php" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"

Thanks in advance

Re: Object not found message displayed

PostPosted: 13. May 2016 15:16
by Altrea
Syam wrote:::1 - - [13/May/2016:19:11:30 +0530] "GET /syam/htaccess/qwe3 HTTP/1.1" 404 1221 "http://localhost/syam/htaccess/index.php" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"ยด

What is /syam/htaccess/qwe3?

Re: Object not found message displayed

PostPosted: 13. May 2016 15:33
by Syam
The index.php file is on the folder named syam, and htaccess is another folder name, and username is qwe3.

And my php redirection code is
<?php echo"<script>location.href='index.php?name=username'</script>"; ?>

Re: Object not found message displayed

PostPosted: 13. May 2016 16:08
by Altrea
You want to rewrite queries with "name" parameter in the query string, which i don't find here.
And i even don't understand the RewriteBase setting you used in your htaccess.

Re: Object not found message displayed

PostPosted: 13. May 2016 16:28
by Syam
My rewrite base setting is
RewriteBase /syam/htaccess/

-------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /syam/htaccess/
RewriteCond %{QUERY_STRING} name=(.+)
RewriteRule ^index\.php %1? [R=301]
</IfModule>
------------------------------------------------------
This is first time i'm rewriting url. I'm using the above code in .htaccess file. Can you please help me with necessary corrections.

Re: Object not found message displayed

PostPosted: 13. May 2016 17:23
by Nobbie
And? Is there a file or folder with name qwe3? And what does it contain?

Why do you apply RewriteBase?

Re: Object not found message displayed

PostPosted: 14. May 2016 08:44
by Syam
qwe3 is not a folder. It is a username

( echo"<script>location.href='index.php?name=qwe1'</script>";)

instead of getting from database straight away added in the script (name=qwe3).


please see the php code is

<?php
if($_POST['banner_login'])
{
$bannr_usrnme=mysql_real_escape_string($_POST["bannr_usrnme"]);
$bannr_pswrd=mysql_real_escape_string($_POST["bannr_pswrd"]);
$bannr_pswrd=sha1($bannr_pswrd);
$sql8="select * from login where (email='$bannr_usrnme' || phone='$bannr_usrnme') and pass='$bannr_pswrd' and status='1'";
$result8=mysql_query($sql8);
if(mysql_num_rows($result8)>0)
{
while($row8=mysql_fetch_array($result8))
{
$type=$row8['type'];
if($type=='super admin')
{
$_SESSION['u_id']= $row8['id'];
$_SESSION['email']=$row8['email'];
echo"<script>location.href='index.php?name=qwe1'</script>";
}
else if($type=='admin')
{
$_SESSION['u_id']= $row8['id'];
$_SESSION['email']=$row8['email'];
echo"<script>location.href='index.php?name=qwe2'</script>";
}
else if($type=='user')
{
$_SESSION['u_id']= $row8['id'];
$_SESSION['email']=$row8['email'];
echo"<script>location.href='index.php?name=qwe3'</script>";
}
else
{
echo"<script>alert('invalid username and password')</script>";
}
}
}
else
{
echo"<script>alert('Does not exist the account')</script>";
}
}
?>

Re: Object not found message displayed

PostPosted: 14. May 2016 10:27
by Nobbie
Syam wrote:qwe3 is not a folder. It is a username


Do you know, what you are doing??

You have a RewriteRule, which creates a Pathname(!), which contains a Username (that ist, what you WANT). Of course Apache trys to open that Pathname, that is how Rewrite works. Last not least, what do you mean by Username, what for??

Re: Object not found message displayed

PostPosted: 14. May 2016 12:24
by Syam
I like to display the username as a url extension (page).
Example in facebook or g plus my page extension is showed as facebook.com/syam .
where syam is a page. Here i like to get domain name.com/qwe3 (qwe3 is my page name).
It is displaying like domain name.com/qwe3 but object not found message is displayed.
With Regards.