.htaccess

Best way to replace file on server

Hello I have to write script in PHP which will be dynamicly replace some files on server from time to time. Easy thing, but the problem is that I want to avoid situation when user request this file during replacing. Then he could get uncompleted file or even error. Best solution to me is block access to my site during replacing by e.g....

Write a php code to be seo permalink url according to current htaccess

Below is example a famous .htaccess RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] What I know here, the result for URL will be http://domain.com/about.php will be http://domain.com/about/ http://domain.com/contact.php will be http://domain.com/cont...

robots.txt and Mod Rewrite in .htaccess

In the robots.txt file, I am about to disallow some sections of my site. For instance, I don't want my "terms and conditions" to be indexed by search engines. User-agent: * Disallow: /terms The real path to the file is actually /data/terms_and_conditions.html But I have used .htaccess to rewrite the URL. Now to my Q, should I ...

Possible infinite loop in mod_rewrite?

I am working on overhauling the URL structure of review pages, which can be filtered by city, county, # of stars and technician. I want to make the pages look like they are static HTML pages as well as replace pluses with hyphens. My goal: -Apply the new style URL's without modifying the reviews page, just the htaccess file -Set up 301 r...

.htaccess exception for several subfolders

Hello I am having some troubles with my script.. when I access http://www.domain.com/this-is-a-topic I want it to redirect to http://www.domain.com/index.php?t=this-is-a-topic... BUT when it says "administration", "sitemap" or some other things, I want it to look either another rewrite condition or simply just get http://www.domain.com...

.htaccess code to redirect old blog urls to new blog urls on a new domain

I'm trying to redirect an old wordpress blog to a new posterous blog using an htaccess file and I am using the code below; the problem is that I can't get the old individual blog posts to redirect to the new ones - they have the same name structure on the new domain name (eg: olddomain.com/post-1 is now newdomain.com/post-1), but if I ty...

.htaccess gives recursion error on everything

I am trying to redirect all traffic through index.php. Here is my .htaccess file: RewriteEngine On RewriteRule ^(.*)$ /index.php?ref=$1 [NC,L] I'm always getting HTTP 500 errors, and I check the error.log and I see that its the internal recursion error. Can anyone help me with this? Thanks. ...

Codeigniter, domain to a certain area of the site

Hi, I'm not a very experienced programmer, and am using CodeIgniter for second time. Suppose I have www.domain1.com. So I will have, say 3 controllers /area1, /area2, /area3. Users can access them as www.domain1.com/area1 etc. if I set the base URL as www.domain1.com. But my problem is, the client wants a certain area of the web, say ar...

htaccess: how to redirect every url that starts with http://site.com/shop

Like the title says, how do I redirect every url that starts with http://site.com/shop to a single page? so I have: http://site.com/shop/index http://site.com/shop/detail/52 http://site.com/shop/download .... etc, and it should be redirected to http://site.com/new_page ...

.htaccess mod_rewrite

hello i am trying to make it so that when you visit my site you don't have to put .php at the end this is what i am using but it isn't working (godaddy hosting) Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php i just added the "Options +Follo...

htaccess advice - how do I write this rule?

I'm not going to lie. I suck at writing htaccess rules. I'm ok with regexes though. Ok, basically, user enters url: www.site.com/page.id or www.site.com/folder/page.id That should be internally written to: www.site.com/index.php?page=id I've got the stuff sorted in the index.php, but I just can't seem to hack it with the htaccess. Wh...

Wordpress multisite causing Error 101 (net::ERR_CONNECTION_RESET): Unknown error.

We have just installed WordPress 3.0.1 and everything worked fine. However, as soon as we started to install the multisite functionality by following this tutorial, things started to go wrong. At the end of step 5, the tutorial has you update your wp-config.php file and .htaccess file. Once we made the reccommended changes to these files...

wordpress mu 404 without end slash

I've just setup a wordpress MU install and almost everything seems to be in working order. When i hit site.com/subsite i get a 404 on site.com but when i go to site.com/subsite/ (notice the trailing slash) everthing seems to work fine. the generated wordpress mod_rewrite code is # BEGIN WordPress RewriteEngine On RewriteBase / Rewrit...

QUERY_STRING in .htaccess While redirecting

How can I allow visitors to use this link (www.example.com/news?id=34) in order to see (www.example.com/index.php?page=news&id=34) Right now I am hiding the extensions of my PHP files in order to make the links look nice. When visitors go to (www.example.com/news) they can see the page (www.example.com/index.php?page=news). However, whe...

Deny direct request using .htaccess

Is there any way to use .htaccess to deny direct Request to a specific part of my website e.g. www.example.com/XXXXX I only want to allow Referer only to XXXXXX. I know that I have to use HTTP_REFERER somehow to accomplish my goal but currently I am using other .htaccess rules and not sure how to combine all rules together. This is what...

Equivalent of this htaccess for IIS7?

What is the equivalent of these rewrite rules: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /index.php [NC,L] In IIS7? These are rewrite rules for Zend Framework and they work under Apache. I tried importi...

htaccess: redirect to new url problem

I would like to redirect any php page with optional parameter to a new clean url eg, from: account.php?id=156 to newurl/account/156 I'm using the following redirectmatch RedirectMatch ^/cmstut/([a-zA-Z0-9_]+)[\.php]?[\?]?[a-zA-Z_]?[=]?([0-9]+)?$ /cmstut/redirect/newurl/$1/$2/$3 [L] but the result I get is it will redirect to newurl/...

redirecting without changing URL

i want to redirect domain domain1.com to domain2.com completely but without changing domain1.com URL. i thought i could do that with .htaccess but i found out that it is not possible because they are to different domains and i should use http:// in .htaccess rule so it would be an external rewriting not an internal rewriting,so the URL ...

How would I use mod_rewrite to turn this query string request in to a clean url?

How can I use mod_rewrite to take http://www.site.com/events?pg=4 and turn it to a clean URL, like so: http://www.site.com/events/4 ? Thanks for the help! ...

Mod_rewrite rule for /login to login.php

Somebody knows a rule wich transforms http://domain/login to http://domain/login.php ? I want it specifically so I can assign also http://domain/loginplease to http://domain/login.php and also http://domain/login to http://domain/login1.php . Thanks in advance. ...