• PHP
  • Ruby on Rails
  • MySQL
  • Linux
    • SELINUX
    • Fedora
    • debian
  • Apache
  • nginx
  • AJAX
Albertech.net

Tag Archives: Apache

Fix: WordPress with password protected subdirectories

July 12, 2012 9:51 am / Albertech.net

If you use WordPress on your root web folder, subdirectories password protected with .htaccess do not work. Users will not get the ability to put in their username and password to access the page. The Apache rewrite rules included in WordPress will forward users to the 404 error page instead.

To get around this, you will need to create a 401 error page in the web root directory (e.g. ~/public_html/401.html) and add the following line to the .htaccess file located in your web root directory.

ErrorDocument 401 /401.html

This also works for other apps using Apache Rewrite Rules, such as Drupal.

Share this:

  • Facebook
  • Google
  • Twitter
  • Print
  • Email
Posted in: Apache, wordpress / Tagged: Apache, rewrite, subdirectories

awstats: Import old log files

September 3, 2009 11:26 am / Albertech.net

One thing I’ve encountered with Awstats is adding in old apache log files. This is useful if you are migrating data from servers. By default, Awstats will ignore ALL past dates in the log that occur before the most recent log entry date. In order to avoid Awstats from finding the “recent log entry date”, you will need move all Awstats cached files into a separate folder. I’ve verified that this works, so if you have any questions feel free to comment.

1) Locate your awstats data directory. Most commonly found in /var/lib/awstats

2) Create a new folder inside the directory. Move all awstats* files to the new folder.

3) Run  awstats update process on all log files in chronological order. AWStats will not complain about the “too old record” because there is no history files in DirData directory that contains compiled data more recent than record.

Edit the awstats.conf inside /etc/awstats
Locate the Apache logfile you need. It must be the oldest one you want to import. Awstats will chronologically add in the files, so make sure you add them in the right order. Edit the line starting with LogFile=”[log file location]”

Run the Awstats command (through the web browser or through shell via the perl command line)

4) Move the history files back. Once you process through all the logfiles, move the Awstats history files inside the /var/lib/awstats/newfolder back into /var/lib/awstats

Share this:

  • Facebook
  • Google
  • Twitter
  • Print
  • Email
Posted in: Apache, Linux / Tagged: Apache, awstats, import, old logs

Cleaner URLs in CodeIgniter

August 11, 2009 5:13 pm / Albertech.net

Here’s a quick tip to make cleaner looking URLs in CodeIgniter PHP framework. By default, if you have an application, the path of the application usually ends after index.php.  Using Apache RewriteEngine, you can make cleaner looking URLs. You can have something similar to mysite.com/cigniter/MyApplication instead of mysite.com/cigniter/index.php/MyApplication

  • Create a file named “.htaccess” inside your root CodeIgniter directory. It should look like the following:RewriteEngine on
    RewriteCond $1 !^(index\.php|images|css|robots\.txt)
    RewriteRule ^(.*)$ /[CODE IGNITER BASE]/index.php/$1 [L]where [CODE IGNITER BASE]  is the directory of your Code Igniter install. For instance, if you named your base install folder “cigniter”, the Rewrite Rule would look like:RewriteRule ^(.*)$ /cigniter/index.php/$1 [L]
  • If you get an error, make sure your Apache install allows for RewriteEngine in that particular folder. This is usually located in /etc/apache2/sites-enabled/YOURSITE The folder needs to have permissions of:AllowOverride AuthConfig
    Options +FollowSymlinksSee: http://www.whoopis.com/howtos/apache-rewrite.html
  • More info on CodeIgniter framework:
    http://codeigniter.com/

Share this:

  • Facebook
  • Google
  • Twitter
  • Print
  • Email
Posted in: Apache, Frameworks / Tagged: Apache, codeigniter, rewrite

Apache configuration for Microsoft Office 2007 files

November 13, 2008 2:33 pm / Albertech.net

If you uploaded some Microsoft Office 2007 files onto your Apache server, you will notice that the files will open up as a zip file from your browser. To fix this, you will need to add the new file extensions to the Apache configuration file so that it will know how to set the correct file type. At first, I tried editing the /etc/mime.types file, but that did not work for me. So, I added the file types into the Apache configuration file and voila — it worked.

In Apache, edit the httpd.conf file. Or, in Apache2 edit the apache2.conf file. Search for the section with the AddType keywords. Make sure you backup the configuration file before making any changes. Add the following lines:

# MIME type fix
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow .pptx

Make sure to test the syntax of the configuration file using apache2ctl configtest or apachectl configtest. Then restart the Apache service via apache2ctl restart or apachectl restart.

If you need to support all Microsoft Office 2007 file extensions, please check out this webmasterworld post.

Share this:

  • Facebook
  • Google
  • Twitter
  • Print
  • Email
Posted in: Tech / Tagged: apach2, Apache, apache2.conf, docx, httpd.conf, MIME, office 2007, ppsx, xlsx

Categories

  • AJAX
  • Android
  • Apache
  • Canon Cameras
  • Cloud
  • CMS
  • Computer Mods
  • Conferences
  • Deals
  • debian
  • Fedora
  • Flash
  • Frameworks
  • git
  • Hardware
  • HTML
  • IDE
  • iPhone
  • iPhone App Review
  • jQuery
  • Linux
  • Mac OS X
  • MySQL
  • nginx
  • PHP
  • portfolio
  • Puppet
  • Ruby on Rails
  • Script Reviews
  • SELINUX
  • Software
  • Software Review
  • SQL Server
  • statistics
  • Tech
  • Tomcat
  • Uncategorized
  • VMWARE
  • VPS
  • Windows
  • wordpress
  • Zend Framework

Blogroll

  • DragonAl Flickr
  • Dropbox – Free 2GB Account
  • James' Blog
  • Javascript Compressor
  • PHP Builder Community
  • PHP-Princess.net
  • Rubular – Regular Expression Validator
  • The Scale-Out Blog
  • Tiny MCE

Tags

activation AJAX android antec Apache AWS awstats canon coda codeigniter debian enclosure external free G1 install vmware tools Internet Explorer iphone 5 jquery Linux mx-1 MySQL office 2007 OSX photoshop PHP plugin plugins portfolio redesigned website review rewrite script security SELinux ssh tinymce tutorial upgrade VMWARE vmware server wordpress wordpress mu XSS zend framework
© Copyright 2013 Albertech.net
Infinity Theme by DesignCoral / WordPress
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.