11
Dave_L
Re: .htaccess help
  • 2006/7/2 21:10

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Quote:

Kmac01 wrote:
I did lots of testing on this, but the only way I can get it working is to add the directive to the main httpd.conf file for appache. Any directives that seem to apply are only available in the main config file, not .htaccess files. (And you must restart apache for the changes to take effect)


Thanks, that's one solution I could use.

But there must be some way to do this with a Location directive in an .htaccess file, or a similar directive such as LocationMatch, Files or FilesMatch. If not, what's the point of allowing these directives in .htaccess files?

On the other hand, since I have several directories that need similar protection, maybe it would be better to specify them centrally in httpd.conf. That might be a more secure approach.

12
Peekay
Re: .htaccess help
  • 2006/7/2 21:30

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Quote:

Kmac01 wrote:

That works for filename issues, but you still end up with a file in windows format (end of line is CR/LF) whereas unix format the end of line is just a line feed (LF). If you open up a files saves as above with the unix vi it will say [DOS].

Sometimes unix/linux systems will not work properly with these files.


FTP in ascii mode. Will automatically convert linefeeds to Unix/Linux format. Always FTP PHP files in ascii mode for this reason.
A thread is for life. Not just for Christmas.

13
Kmac01
Re: .htaccess help
  • 2006/7/2 21:30

  • Kmac01

  • Just popping in

  • Posts: 4

  • Since: 2006/6/3 2


Quote:

Dave_L wrote:
Thanks, that's one solution I could use.

But there must be some way to do this with a Location directive in an .htaccess file, or a similar directive such as LocationMatch, Files or FilesMatch. If not, what's the point of allowing these directives in .htaccess files?


Well, during my testing I found the FilesMatch to be more for blocking a file or type of file like images. If you use then that one particular file will be blocked (works with wildcards also) but I could not get it to work on a directory only files. And I think the LocationMatch is also only allowed in the httpd.conf file not .htaccess.

14
Kmac01
Re: .htaccess help
  • 2006/7/2 21:36

  • Kmac01

  • Just popping in

  • Posts: 4

  • Since: 2006/6/3 2


Quote:

Peekay wrote:

FTP in ascii mode. Will automatically convert linefeeds to Unix/Linux format. Always FTP PHP files in ascii mode for this reason.


True, but my situation is a little different. I use samba to map a share over my network. Then I can edit the files directly and don't need to ftp anything.

15
Peekay
Re: .htaccess help
  • 2006/7/2 22:00

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Ah, I see. Not so good then.

We now FTP all files between the Linux box, Macs and PCs in my studio because of the linefeed issue. It's drag-n-drop with the new FTP apps so we don't really find it a hassle.

I would have thought Samba would have catered for the discrepancy?
A thread is for life. Not just for Christmas.

16
Peekay
Re: .htaccess help
  • 2006/7/2 22:25

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Quote:

Bender wrote:
(ever tried to create a file named .htaccess under windows ... well thats why i can´t test it here with xampp and my sites are all shared hosting so i have no access to httpd.conf.


To use .htaccess and mod_rewrite with XAMPP, you have to edit xampp/apache/conf/http.conf

1) Check around line 221 the entry:
AddType application/x-httpd-php .php .php3 .phtml
and make sure the .phtml extension is present.

2) Around line 414, check that the entry specifies the .htaccess file:
AccessFilename .htaccess

3) Around line 166, uncomment the Line:
#LoadModule rewrite_module modules/mod_rewrite.so

4) Check the entry around line 362. If it reads:
AllowOverride None
change it to:
AllowOverride All

You need to re-start the Apache server for the effects to take place.

Mod_rewrite may already be enabled on your shared server. Not all hosts allow you to create .htaccess files, but if yours does, upload two files - test1.html and test2.html - and place a simple .htaccess file in the same folder. The contents should read:

# Test rewrite is on
RewriteEngine On
RewriteRule 
^test1.html$ /test2.html [R=301]
#


If you then enter the URL to test1.html in a browser and wind up looking at test2.html... it's working.
A thread is for life. Not just for Christmas.

Login

Who's Online

265 user(s) are online (230 user(s) are browsing Support Forums)


Members: 0


Guests: 265


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits