WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-10-2007, 06:56 AM
WebProWorld Member
 

Join Date: May 2007
Location: Grimsargh, UK
Posts: 37
apwade RepRank 0
Default .htaccess commands

Does anybody have a list of the .htaccess commands with brief explantation or know where i can find such a list?

Also does anybody know how to redirect a directory of files to one file?

i.e. /shops/shop1.htm redirects generic.htm
/shops/shop2.htm redirects generic.htm
/shops/shop3.htm redirects generic.htm etc

and keeps the old url address

Cheers Andrew
__________________
Discount shopping vouchers
Reply With Quote
  #2 (permalink)  
Old 08-10-2007, 09:26 AM
wige's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,782
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: .htaccess commands

The best resource for server directives would be at Apache HTTP Server Version 2.2 Documentation - Apache HTTP Server

To redirect an entire directory, you would use
Code:
RedirectMatch 301 ^/shops/.*$ http://yourserver/generic.htm
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #3 (permalink)  
Old 08-10-2007, 11:39 AM
kgun's Avatar
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,125
kgun RepRank 3kgun RepRank 3
Default Re: .htaccess commands

Is there a command that allow files parsed py PHP to be written to disk on a shared server?

I have to do all my configuration in .htaccess, since I think my hoster for security reason do not allow me access to php.ini on a shared server.

Here is a typical example august 10 2007:

http://www.kjellbleivik.com/SpHelp/morgy1

PHP Code:
print 'PHP Version on this web server is: ' PHP_VERSION '<br /> <br />'
//Parsing starts here 
$tagsXML "<root><node1>This is parsed in the same way on the latest versions of FireFox, IE and Opera</node1></root>"
$sxe = new SimpleXMLElement($tagsXML); 
print 
$sxe->asXML(); 
print 
'<br /> <br />'
print 
'You need permission to save a file to the disk'
print 
'<br />'
$sxe->asXML('morgy.xml');  //No permission to save to file 
?> 
asXML is the cause.
Reply With Quote
  #4 (permalink)  
Old 08-10-2007, 12:06 PM
wige's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,782
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: .htaccess commands

This is not an .htaccess or PHP.ini issue, this is an issue with the file system that you are using. If you have FTP access to the folder where you are trying to write the file, which should only contain files and not executable code, you would want to change the permissions of that folder to world writable.

You can test if the directory can be written to by using the following:
PHP Code:
if (is_writable('directory/')) {
   
$sxe->asXML('directory/morgy.xml') or die('can\'t write the file');
} else {
   echo 
'Permissions insufficient to write here.';

And of course at the end of the script you would have
PHP Code:
function die($msg) { echo ($msg); exit();} 
Assuming you are using a Linux server, you should chmod the folder you are writing to to 774 provided the folder only contains text files.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #5 (permalink)  
Old 08-10-2007, 02:23 PM
kgun's Avatar
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,125
kgun RepRank 3kgun RepRank 3
Default Re: .htaccess commands

Ok, I take the chance that this is correct and again contribute positively to your RepRank, even if we are competitors

If it is not, I will decrease it later on
Reply With Quote
  #6 (permalink)  
Old 08-10-2007, 02:27 PM
kgun's Avatar
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,125
kgun RepRank 3kgun RepRank 3
Default Re: .htaccess commands

I could not increase your reprank, since I have only given 4 contributions before aomong them as you know you are one of them.

Hopefulle good advice as usual and may have saved me some hours work.

I can not spread RepRank in east and west. Have to spread RR more to contribute to yours Funny ranking system
Reply With Quote
  #7 (permalink)  
Old 08-15-2007, 02:45 PM
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: United Kingdom
Posts: 1,772
TrafficProducer RepRank 1
Default Re: .htaccess commands

Here's some other links that may help you out:-

htaccess Files How to .htaccess
__________________
Videos to Watch and Video Publishing
Affiliate Program! Our Affiliate Program Pays 50.00% Business Support

Last edited by TrafficProducer : 08-15-2007 at 02:51 PM.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: ,



Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess issues Sub Rosa IT Discussion Forum 1 07-06-2007 06:28 PM
.htaccess hell dak888 Web Programming Discussion Forum 5 03-26-2007 04:30 PM
What is .htaccess and how does it work? complete Web Programming Discussion Forum 1 01-02-2006 06:40 AM
how to make use of .htaccess Miki Search Engine Optimization Forum 8 06-11-2005 09:53 AM
.htaccess question jestep Web Programming Discussion Forum 2 06-09-2005 12:07 PM


Search Engine Optimization by vBSEO 3.2.0