LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-22-2010, 10:27 AM   #1
Helstedxd
LQ Newbie
 
Registered: Aug 2010
Posts: 21

Rep: Reputation: 0
.htaccess disappeared, and wont work properly


Hi LQ's

I have a server running Debian, and it's running PHP5, apache2, mysql and pure ftp... but when i upload .htaccess and press F5 the .htaccess file disappears... but i it still there.

the .htaccess file look like this
Code:
RewriteEngine on
RewriteRule ^php_show/([^/]+)/?$ php_show.php?id=$1
But when i create the php_show.php
with content

PHP Code:
<?php
print_r
($_GET);
?>
then go to the url http://(server ip)/php_show/test
it returns

Array ( [id] => )
 
Old 08-22-2010, 12:02 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,641

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
Hi and welcome to LQ,

Your RewriteRule works here: It gives: Array ( [id] => test)
Are you sure you're using the correct .htaccess? Because you say that after uploading you cannot see it anymore, it could be that you don't have permissions to overwrite it and you're using a wrong .htaccess.
 
Old 08-22-2010, 12:29 PM   #3
Helstedxd
LQ Newbie
 
Registered: Aug 2010
Posts: 21

Original Poster
Rep: Reputation: 0
no if i try to upload another .htaccess does my FTP client ask me if i want to overwrite the old .htaccess file, so it is there, but i can't see it
 
Old 08-22-2010, 12:37 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,641

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
Yes, but are you sure that the existing .htaccess is overwritten by the one you are uploading?
Could you download it back to see if it's the correct one?
 
Old 08-22-2010, 04:29 PM   #5
Helstedxd
LQ Newbie
 
Registered: Aug 2010
Posts: 21

Original Poster
Rep: Reputation: 0
yes i can download it, by using my browser after i have turned Deny from all off in apache2.
but i cant see it in my ftp client

Last edited by Helstedxd; 08-22-2010 at 04:31 PM. Reason: explanatory
 
Old 08-22-2010, 05:11 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,641

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
Hi,

Leave the "Deny from all" the way it was, because otherwise .htaccess could be downloaded/viewed from others.
What ftp client are you using? Are you sure it can show "hidden" files (files that stat with a dot)?

Anyway, could you try the following rule and see if it works?
Code:
RewriteRule ^php_show/(.*)$ php_show.php?id=$1
 
Old 08-22-2010, 11:34 PM   #7
Helstedxd
LQ Newbie
 
Registered: Aug 2010
Posts: 21

Original Poster
Rep: Reputation: 0
My FTP client is Filezilla, and that last code you send returned
Array ( [id] => )

Last edited by Helstedxd; 08-22-2010 at 11:35 PM.
 
Old 08-23-2010, 02:59 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,641

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
So, is the .htaccess you've downloaded the same as the one you're trying to use and it's not working?
And if yes, are you sure it's not your browser cache that gives you always the same page?

Try this:
Code:
RewriteRule ^php_show/(.*)$ /php_show.php?blah=$1
and see what you get

BTW you can enable rewrite logging to find out what happens with your rule. To do so, add in httpd.conf the following
Code:
RewriteLogLevel 9
RewriteLog logs/rewrite_log
 
Old 08-23-2010, 07:01 AM   #9
Helstedxd
LQ Newbie
 
Registered: Aug 2010
Posts: 21

Original Poster
Rep: Reputation: 0
I just found out even without a .htaccess file i can go to my php_show.php by typing

server ip/php_show

so i think that is my problem, but how to turn that access possibility off?
 
Old 08-23-2010, 07:34 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,641

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
Are you sure it's not your browser's cache and you don't have other rewrite rules in httpd.conf, or the included *.conf files?

Change the rule LHS to something else (like the following) and see what you get when you visit: http://x.x.x.x/whatever/blah:
Code:
RewriteRule ^whatever/(.*)$ php_show.php?id=$1
 
Old 08-23-2010, 09:37 AM   #11
Helstedxd
LQ Newbie
 
Registered: Aug 2010
Posts: 21

Original Poster
Rep: Reputation: 0
now i get a error 404 file
 
Old 08-23-2010, 12:13 PM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,641

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
What does the error says? It can't find /whatever? If that's the case, most likely mod_rewrite does not work or is not loaded.
1.Run
Code:
a2enmod rewrite
to enable mod_rewrite if not already enabled.

2. Also quoting from this
Quote:
Then edit /etc/apache2/sites-available/000-default

Find the following

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

and change it to

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
Restart apache and see if it works.

Regadrs
 
Old 08-23-2010, 01:53 PM   #13
Helstedxd
LQ Newbie
 
Registered: Aug 2010
Posts: 21

Original Poster
Rep: Reputation: 0
i want to say i used this tut to setup my server
http://www.howtoforge.com/perfect-se...nny-ispconfig3
can it have anything to do with it?
i have also installed ffmpeg and flvtool2
but i think i dont know how to use ISPconfig properly
 
Old 08-23-2010, 02:43 PM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,641

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
According to the tutorial you've followed, mod_rewrite is eanbled.
So you have to check if there is a "AllowOverride all" in /etc/apache2/apache2.conf or in /etc/apache2/sites-enabled/000-default.

Or, you can put the rewrite stuff directly in /etc/apache2/sites-enabled/000-default and restart apache to see if .htaccess is the problem
 
Old 08-23-2010, 03:04 PM   #15
Helstedxd
LQ Newbie
 
Registered: Aug 2010
Posts: 21

Original Poster
Rep: Reputation: 0
etc/apache2/sites-available/000-default <- is empty on my server, but i think it's ISPconfig that is doing it, so i think i will formate my server and not install ISPconfig
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
webcams and scanners wont work properly beejayess SUSE / openSUSE 0 03-20-2007 03:11 PM
mplayer wont work on suse 9.2 properly sephitoh999 Linux - Software 3 03-17-2005 11:52 AM
Iptables in fedora wont work properly nightmare6667 Linux - Networking 2 02-22-2004 12:06 PM
Suse 9, RH9 wont install properly. Mandrake 9 wont boot properly? Help. l2ich84 Linux - Newbie 1 01-31-2004 11:02 AM
why wont my mouse work properly with kde? nikolai Mandriva 2 01-22-2004 10:15 AM


All times are GMT -5. The time now is 12:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration