.htaccess

mod_rewrite N number of directories before URL

Hi There, I want to redirect users from a URL formatted like this: http://blog.mysite.com/any/number/of/directories/<POSTNAME>.html TO: http://mysite.com/about/blog/entry/<POSTNAME>/ Where is the same hyphen-separated string, and, the original URL can have any number of directories before the filename (none of which a...

Is It Possible to Alter the Displayed URL from the Actual URL?

I posted a question the other day about how to change the displayed URL on a Wordpress-generated page, specifically from something like "mysite.com/?cat=3" to just "mysite.com". I got a few replies that steered me towards doing some type of redirect with .htacess. After some research and experimentation, I realized that it's not so muc...

RewriteRule - folder exceptions (with dashes)

I have drupal installed in my website root with a directory called xi-admin underneath it, that directory has a .htaccess inside doing password protection. problem is, is that it is rewriting http://www.example.com/xi-admin/ back to index.php???? RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUE...

500 Internal Server Error for addtype in htaccess

In reference to the accepted answer in http://stackoverflow.com/questions/3464141/php-website-to-aspx-net-website. Creating a new post since that post was over-loaded with comments. .htaccess file AddType application/x-httpd-php .aspx AllowOverride AuthConfig in apache config file. trying to parse php in the aspx page. index.html / ...

Help writing an htaccess.

I'd like an htaccess file that would redirect all pages to my index.php so that I can then parse the url and handle the rest. I just don't know how to write it. thanks ...

apache url rewrite with htaccess

This is my .htaccess, and I'd like to rewrite my domain.com to www.domain.com. How can i do this? RewriteEngine On RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|xml|txt)$ RewriteCond %{REQUEST_URI} !example/ RewriteRule ^(.*)$ index.php?q=$1 [QSA] Thanks ...

htaccess / mod_rewrite problems with possible subdirectories.

Hi! I am working on a very dynamic system where i have two identical htaccess files in / and in /somepath. The reason for this that the domain could be pointed into /somepath, but i never know if it is. When it is pointed to /somepath there are no problems, but when its not it seems like when i request /somepath/page/foo/bar the htacc...

Multiple query parameter RESTful URL with .htaccess

Hi all, I would like to use following RESTful URL for a web site I'm working on. http://mysite.com/Products/category=bags&colours=black can anyone please tell me how to achieve this with .htaccess? Oscar ...

Basic Static-to-Static Rewrite (or Redirect) via htaccess or httpd.conf

We are moving from one site language/CMS (coldfusion/custom) to another (PHP/Drupal) and need to have some of our old pages redirected to new ones. I have access to both the .htaccess and httpd.conf (and apache2.conf) as this is a vps on Linode. Most of them cannot be done via regular expression (they contain GUIDs in the URL) and we're...

htaccess redirect to a folder...

I wasn't sure what the title should be but its s simple concept but I'm useless with .htaccess rewrites. I currently have: RewriteRule ^([a-zA-z0-9_-]+)/?$ index.php?page=$1 which will happily send all requests to my index and I can do what I want. I have: RewriteRule ^events/([a-zA-Z0-9-./]+)/?$ index.php?page=events/index&id=$1 ...

mod_rewrite creates 301 instead of transparent redirection if folder exists

Hello, i'm having a small problem here. I'm using a simple rule to redirect all requests to a script, excepts some folders with static content : RewriteEngine On RewriteCond $1 !^(templates|css|js|uploads)/(.*)$ RewriteRule ^(.*)$ index.php?url=$1 [L,QSA] Most of the time, the redirection is good and transparent. But if the folder mat...

combining css and js files + css images

I'm playing with this combine.php file and it looks nice, but I'm wondering if there is a work around for my problem. I now have fewer script and link tags for my resources that look and work like they're supposed to <script type="text/javascript" src="http://path/to/server/javascript/libjs/jqueryui/1.8/development-bundle/ui/minified/j...

Sitemap xml file; Does the url have to end with an ".htm" ?

I have a website which has .htaccess rewrite rules. And alot of them. This means for example that www.mydomain.com/classifieds/something_very_very_very_very_Very_very_looong.php?id=12345 becomes www.mydomain.com/classifieds/12345 Now, this might be a stupid question, but I must be sure... I have followed several guide...

Rewrite Problem - L(ast) not being respected?

So I'm working on a CSS/JS compressing system for a site, that has basically the following htaccess RewriteEngine On ... RewriteRule ^css/images/(.*)$ images/site/$1?%{QUERY_STRING} [L] RewriteRule ^css/([0-9a-fA-F]{32})$ assets.php?hash=$1 [L] RewriteCond %{HTTP_HOST} ^www.site.com [NC] RewriteRule ^(.*)$ http://site.com/$1 [L,R=301...

htacess hotlinking question

Hello, My htaccess have this code # # Apache/PHP settings: # Options -Indexes Options +FollowSymLinks **# NOT WORKING # RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www.)?yourwebdomain.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www.)?friend1domain.com(/)?.*$ [NC] RewriteCond %{HTTP...

HTACCESS password protection for parked domain, but not for main domain

Hi, I have two domain: asdf.com and asdf.ru (.ru is a parked domain). They are pointing to the same folder on the server. (Everything is the same, the only difference is the language). I cannot use subdirectories. Is it possible to protect the .ru domain with password, but leave unprotected the .com domain? Thank you. ...

.htaccess on specific filetypes

Hi! I have some magic stuff in my htaccess. It works very well but I don't know how RewriteRule ^[^_+/]. index.php I think it says that all requests should go through index.php no matter which directory the visitor ask for. So far so good. However images, css files, js files etc should of course not be parsed in index.php. Can I ex...

.htaccess rewrite problem

Having a weird problem. I have two sites, first is www.example.com/folder/site1/, second is www.example.com/folder/site2/. The problem I have is that my .htaccess code is only working on site1, why? My .htaccess code looks like this: RewriteEngine On RewriteBase /folder/site1/ # Do not enable rewriting for files or directories that ...

Simple 301 redirect in .htaccess with query string does not work with Redirect directive

I am trying to redirect a single URL in a .htaccess file with Redirect: Redirect 301 /index2.php?option=com_rss&feed=RSS2.0&no_html=1 /something/somethingelse/ I have a bunch of other similar rules which work using directory structure URLs, but this one refuses to get processed. Redirect 301 /old/url/ /new/url/ Do I have to do anyt...

htaccess - forcing trailing slash two directories deep.

My website structure has a root /index.php, some files as /directory/index.php and some as /directory/(filename).php I have the following .htaccess which removes the php extensions and the "index.php" for my URLs, and forces trailing slashes on the first level directories for SEO goodness: RewriteCond %{REQUEST_FILENAME} !-d RewriteCon...