.htaccess

Using .htaccess for multiple redirects.

I have a web site that has the file extension of .php. As of right now I have it setup to rewrite that server side using .htaccess to drop the .php from the file name making it example.com/filename, I also have it set to redirect/filename to /filename/. I now want to make it redirect /filename.php to /filename/. How can I do this? What ...

htaccess 301 redirect entire site but with exceptions

I am trying to create an htaccess file to redirect my entire site except with some exceptions, but I can't get it working. I need to redirect the entire thing, provide a specific redirect, and exclude two pages. Below is my non-working sample. Thanks! RewriteCond %{REQUEST_URI} !^/events/index.html RewriteCond %{REQUEST_URI} !^/calendar...

url rewriting problem

in my .htaccess file i have the following Options -Indexes RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)/(.*)$ index.php?lang=$1&id=$2 [L] so when i wrote http://mydomain.com/am/home it will be redirected to http://mydomain.com?lang=am&id=home but i have a cms folder, and i need to go to http://my...

.htaccess domain redirect

Hello Guys, I have a server which has 3 domains all pointing to it. All domains are on the same website. www.domain1.com www.domain2.com www.domain3.com How can I redirect www.domain3.com to www.domain3.com/test.html using .htaccess? Thanks! ...

.htaccess URL redirect

Hello Guys, How can I redirect http://domain.com/blog/index.php/weblog/rss_2.0/ to http://www.domain.com/feed/ with .htaccess? The website has 3 domains pointing to it and all is using the same htaccess. Thanks! ...

Access GET variables with PHP + .htaccess

I'm developing a website using PHP. My .htaccess has this rewrite rule: RewriteEngine On RewriteRule ^book/([^/]*)\.html$ book.php?title=$1 [L] So the URL that looked like: www.example.com/book.php?title=title-of-the-book turns into www.example.com/book/title-of-the-book.html In a specific case, from another page in the site, I want...

.htaccess URLs: Use File Extension?

When using .htaccess to redefine the URLs for a site, there are two clear options: Provide no extension, as StackOverflow has done with URLs like http://stackoverflow.com/questions/ask Provide the extension of .html, regardless of the underlying technology, so something like http://stackoverflow.com/questions/ask.html Are there any s...

Apache mod_rewrite: rewrite ^(.*)\.html$ to $1.php and forbid direct access to ^(.*)\.php$

My intent is to rewrite urls ending in .html to .php (not actually all of them, but that shouldn't really matter with regard to this question). I'd also like to disallow urls ending in .php (so that the user can access every page only using urls with .html extension). I'm using these rules inside .htaccess: RewriteRule ^(.*)\.php$ $1.h...

browsers don't resend form data in ajax call if they are redirected??!

Hi guys, I've been tinkering with URL Rewriting on my site and fixing the canonicalization of my URLs (so I don't have duplicate data on search engines, etc.) and it was recommended everywhere to either always remove/force the trailing slash (I chose to remove it) and also to redirect /index to . So I put the following two rules in my ...

Setting up an internal foswiki (only authorized can view/edit)

I want to set up an internal foswiki to which only authorized users have access to and can view/edit the contents. One way of doing this is to modify the .htaccess file for the folder and generate as many as authorized users. But that is not very secure, so I don't want to use it Is there any way to do this in Foswiki. ...

.htaccess redirects with dynamic URLs

I am having problems doing a redirect for some URLS, the ones from the old site that have a ? sign, won't redirect, every other URL will do. example: OLD: /laser-alignment-resources/presentations.cfm?pres=diaphragm NEW: http://www.acquip.com/en/presentations/47-presentation-internal-laser-diaphragm-alignment Won't work, I am sure I did...

Protecting the login page

I'm trying to add extra security to my drupal site. I removed the login block, but it can also be accessed through http://mydrupalsite.com/user It's still needed to allow the admin account in, but is there a way to protect this single page with htaccess or something more robust than what drupal allows out of the box? ...

.htaccess RewriteRule help

I have been able to change the 'location' of my images with RewriteRule, but I have 3 lines of code to do this because of subdirectories in the image folders RewriteRule ^images/([^/]+).(jpg|jpeg|bmp|gif|png)$ /includes/images/$1.$2 RewriteRule ^images/([^/]+)/([^/]+).(jpg|jpeg|bmp|gif|png)$ /includes/images/$1/$2.$3 RewriteRule ^images...

Mod_Rewrite existing file check goes pear shaped, or passes wrong querystring.

I'm using Apache, Python (fastcgi), mod_rewrite. I want http://foo/bar to redirect internally to http://main.py?q=foo/bar Now my .htacess file contains Options +ExecCGI AddHandler cgi-script .py DirectoryIndex main.py RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) mai...

Hide Last Modified time on apaches directory index/listing

Hi, I have this set up in my .htaccess Options +Indexes IndexOptions -FancyIndexing but even with -fancyindexing, it shows the modification time. How do you disable this? thanks ...

How can I remove ID veriable from URL with htaccess?

I'm sorry for complexive question. I've got a website that reading contents from MySQL database to get video information just like YouTube. I've 7 column: id, title, desc, url, date, whosadded, views. I want to do is Rewriting url's from /video.php?id=X to /title-music-video.html There's ( http://www.devarticles.com/c/a/Apache/Using-...

mod_rewrite on substring in URL

I'm forcing HTTPS on my site using mod_rewrite but I want to change this to HTTP for any URL with the substring com_bookmangement in the URL. So http://www.example.com/index.php?option=com_content&view=article&id=85&Itemid=140 will be directed to https://www.example.com/index.php??option=com_content&view=article&amp...

Adding encoded chars to the url breaks htaccess

Hello Here's my code: RewriteEngine on RewriteRule page/(.*) index.php?url=$1 [NC] When I access page/http://google.com/ = works just fine When I access page/http%3A%2F%2Fgoogle.com%2F = server reports 404 Martti Laine ...

Trying to hide a part of the url with mod_rewrite

Hi, I'm attempting to hide a part of an url from the address, because it's useless mouse coordinates sent due to input type="image" The URL is: www.example.com/search.html?mode=fulltext&query=HelloWorld&ssubmit.x=0&ssubmit.y=0 I want to hide the ssubmit.x and ssubmit.y part. I tried adding the following rule to .htaccess, but withou...

Problem with htaccess URL rewrite rule, query string is being appended to resulting URL

I have a set of rewrite rules that are supposed to process a URL that has anywhere from 1 to 5 parameters. So my URL might look like this: www.site.com/topic1/page1 or www.site.com/topic1/sub1/page1. Here are my rules in this example: RewriteRule ^([^/.]+)/?$ /staticpages/process-selection.php?param1=$1 [E=rwdone:yes,L] RewriteRule ...