.htaccess

When I try to GZIP .js files using PHP I get some kind of php related error.

Okay, So I've googled a couple of pages and come up with the following solution: Add this in .htaccess #Active GZIP for php-files php_flag zlib.output_compression On php_value zlib.output_compression_level 5 and this for .js and .css: AddHandler application/x-httpd-php .css .js php_value auto_prepend_file /Library/WebServer/Documen...

mod_rewrite multiple directories to a php file

RewriteEngine on RewriteRule ^/(dir1|dir2|dir3)/(.*)$ /targetfile.php [R,L] http://www.somesite.com/dir1 -> http://www.somesite.com/targetfile.php http://www.somesite.com/dir2 -> http://www.somesite.com/targetfile.php http://www.somesite.com/dir3 -> http://www.somesite.com/targetfile.php From what I've seen online, this should work. U...

How can I redirect my web pages using .htaccess so old links are redirected to new ones?

I have links which has an old format as www.mydomain.com/dir/this_my_page.html and my new script needs to be forwarded to www.mydomain.com/newdir/this+my+page.htm... What am I going to edit in my .htaccess file so this can be made possible? Can anyone help me with the mod_rewrite function of the htaccess? ...

htaccess redirect problem

I'm trying to get my .htaccess to redirect all requests to the /blogs directory, except for requests that start with /staff. This is what I have so far: RewriteEngine On RewriteRule ^staff(.*)$ staff/$1 [L] RewriteRule ^(.*)$ blogs/$1 [L] It works fine for every case, except when I do http://mydomain.com/staff or http://mydomain.com/...

Help with basic .htaccess mod_rewrite.

I am currently interpreting sub-domain wild-cards with php and i would like to handle them with .htaccess, user profiles will be accessed at http://username.mysite.com/ (or for some people http://www.username.mysite.com/) which should use /main.php?action=profile The hardest part of this is making /error/i+am+a+test+message or /files/ia...

.htaccess files when hosting Drupal 6 sites on IIS 7?

I want to run Drupal 6 on our Windows 2008 server using the included IIS 7 web server. There are a few blogs giving various instructions on doing so, but when I try to create Drupal sites and/or active some modules using IIS 7, I get error messages about creating folders and/or missing .htaccess files. It looks like Drupal relies on .h...

Protecting HTML files with .htaccess

My PHP app uses 404 Documents to generate HTML files so that multiple queries to the same HTML file only cause the generation to run once. I'd like to intercept requests to the HTML files so that the user needs to have an established PHP Session in order to pull up the files. In the best case, SESSION ID would be used in the URL and fo...

Help with basic .htaccess mod_rewrite. (More defined)

This is a continuation of: http://stackoverflow.com/questions/623161/help-with-basic-htaccess-modrewrite I was told to use RewriteRule ^error/(.*) index.php?error=$1 [L] RewriteRule ^file/(.*) index.php?file=$1 [L] and RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC] before each, but it dosn't really help me specifically. I am u...

htaccess won't load images and css

I recently changed the directory to one of my websites and wrote a rule within the htaccess file to handle the redirect. However, the css and images fail to load now. Options -Indexes Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^(\.*)$ http://www.myDomain.com/temp_site/$1 [R=301,L] EDIT: Some of the files that...

Help fix a small htaccess issue reguarding mod_rewrite

RewriteCond %{HTTP_HOST} ^[a-z]+.orbno.com$ RewriteCond %{HTTP_HOST} !^(www.)?orbno.com$ RewriteCond %{REQUEST_URI} download/ RewriteRule (.*) /download.php\?action=$1&user=%1 [L] Two small issues, this is the output: array(2) { ["action"]=> string(23) "download/email-logo.png" ["user"]=> string(0) "" } I want the user to...

Why avoid CGI for Python with LAMP hosting?

I have been using PHP for years. Lately I've come across numerous forum posts stating that PHP is outdated, that modern programming languages are easier, more secure, etc. etc. So, I decided to start learning Python. Since I'm used to using PHP, I just started building pages by uploading an .htaccess file with: addtype text/html py add...

Apache, .htaccess - Forbidding direct access to a file, but allow rewrites to go there

I've figured out how to write something like www.test.com/test to www.test.com/test.php. This is useful to give a simpler browsing experience and obscure the use of the PHP. However, I'd like to go farther and disallow access to www.test.com/test.php completely, and allow access only through www.test.com/test in order to prevent people f...

site 5x faster via mod_rewrite, but CSS images are broken

I am using .htaccess to accelerate a site with the following redirects: request for http://example.com/images/name.jpg routed to http://i.example.com/name.jpg request for http://example.com/css/name.css routed to http://c.example.com/name.css From listening to the Stack Overflow podcast, I learned that this could make a site fa...

Manage multiple websites from one domain

Hello, I have been looking for a while now to find a solution to accomplish the following system. I would like to build a PHP system on, let's say, domainA. On this domainA I will allow an administrator to 'create' a new website. This website contains only of pieces of text, which are all stored in a database. This, I know how to do. ...

Changing WordPress URL structure while maintaing the proper 301 redirects with mod_rewrite

I currently have a blog set up with WordPress using URLs like so: www.domain.com/blog/?pid=384092817 This was before I knew anything about anything. There's a significant amount of content there now and I want to change my URL structure to: www.domain.com/my-post-title-384092817 Is there a way to set up my .h...

Mod Rewrite, pass parameters from URL1 to URL2

I'm trying to rewrite the following URL test.php?par1=foo&par2=bar Into... newtest.php?hidden_par=blah&par1=foo&par2=bar I have this rule, that does not work: RewriteRule ^test.php\??(.*?)$ newtest.php?hiden_par=blah&$1 [L] Could this be done using RewriteCond or something else? (say, could this be done ?), thanks in advance. ...

Know a .htaccess mod_rewrite work around for loading xml files?

Here is my current htaccess code: (turn engine on and such) RewriteRule ^foo.xml$ bar.php [NC] This code works fanstastic on domain names like foobar.com, etc. It does not work for temporary domains like such: bar.com/~foo/ Is there a work around for this? Any help greatly appreciated! ...

How can I use htaccess to force www. on multiple domains

Basically I have a folder on my webserver that I assign to new domains whenever I buy them that only has an index.html and an images folder. It is basically just has my logo and says the domain is under construction and coming soon. Normally when I want to force the www. prefix I use the following code: rewritecond %{HTTP_HOST} ^domai...

How to use htaccess to flip from https to http

Well I have a site that uses relative paths for all the URLs. I just added a shopping cart so the two or three checkout pages are using HTTPS instead of HTTP. My problem is that a user is mid way through checkout and clicks a link on the navigation or whatever it seems them to that page with HTTPS when it is a page that doesn't require...

Joomla and non-Joomla subfolders

I have a Joomla installation with search-friendly-urls at the root level of the domain, but my host is giving me access to my website stats (which requires authentication) in domain.com/stats, and I cannot see it, just a Joomla generated 404 error. I thought this might be due to the .htaccess so I tried adding this line to the top: Rew...