.htaccess

Renaming PHP URLs with HTACCESS

I am building a web app that puts out a link like the following: http://www.sample.com/?a=bj7phm I would like for it to look something like this: http://www.sample.com/BJ7PHM Is this possible within the HTACCESS? -B ...

.htaccess to hide CSS/JS version

Hello, I was wondering if it's at all possible to run a RewriteRule that will hide a CSS version in a link tag. Ex. link href="css/global.css?v=1.2.3" rel="stylesheet" type="text/css" To show up as Ex. link href="css/global.css" rel="stylesheet" type="text/css" I can't seem to find anything on this subject and everything I've attempt...

htaccess rule conflict?

In my .htaccess file I have the following rule defined. RewriteRule t/([^.]+)/$ /video/tag.php?tag=$1 [QSA] This rule is working fine for tag pages. When I am accessing URL as http://example.com/video/t/funny/ then its displaying all the result with tag funny. But When I am accessing a URL http://example.com/video/script/common/vide...

How to use mod_rewrite to change external incoming images to local images?

Hi, I'm trying to figure out how to use mod_rewrite so that I can replace linked images (coming in externally) and use local ones instead. Why am I doing this? I have a plugin which I'm integrating into my site, which uses ugly external images as buttons, and I want to redo these buttons to match my site. The links come in external...

.htaccess URL reroute to different folder based on first part of query

Here is my .htaccess now rewriteengine on rewritecond %{HTTP_HOST} ^www.example.com$ [OR] rewritecond %{HTTP_HOST} ^example.com$ rewriterule ^index.php/? "http\:\/\/example\.com\/" [R=301,L] #4a397bb852bc9 Which sends all requests from the root directory to index.php What I need to do is send all requests from www.example.com/site2/ t...

A simple htaccess redirect

How would I write a redirect rule that would let me use both http://www.site.com/rss and http://www.site.com/anydirectory/rss rather than http://www.site.com/rss.xml and http://www.site.com/anydirectory/rss.xml ? I think I'm close, but for some reason, it's a Monday. RewriteRule ^(.*)/rss.\xml/$ $1/rss [L] ...

Can iPhone auto redirect be disabled if user wants to view full site?

I am basically producing a simple, watered down, iPhone specific sites on a sub-domain of the original. I know of various auto redirects, like the htaccess & user agent scripts/rules that take the user straight to the iPhone specific site, but these scripts do not cater for someone who has come from the iPhone specific site that wants t...

How to rewrite part of the url with .htaccess?

Hello! I'm not that good with .htaccess, so I wonder, how can I rewrite default 'node' part of the url to an 'article' for example, so that server will output 'article/1' instead of 'node/1'. I need this to be done on a server side, so with the use of .htaccess only. Any guess? ...

Weird .htaccess url rewrite discrepancy.

So http://myopicvoid.org/ when loaded in Firefox or Chrome, automatically redirects to http://myopicvoid.org/main as well it should, but not in IE8. What exactly would cause this? My .htaccess is as follows: Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTP_HOST} ^myopicvoid\.org$ RewriteCond %{REQUEST_URI} ^/$ RewriteRule /...

mod_rewrite to get query string PHP

I asked a question a while ago to sort out my directory structure and you all solved my problem (Thanks!) but im now changing this site to another server and rewrite rule does not work. I cannot find the problem. I sent a support ticked to the hosting and they said: If that statement doesnt work then it will be either incorrect, or n...

How do I make .htaccess work on the current directory and not subdirectories?

I'm using mod rewrite to access my PHP files in the root directory of my website indirectly. Currently, I have something like this, RewriteRule ^(blog|about|page3|etc)$ /$1.php [L] But what I would like to use is RewriteRule ^(.*)$ /$1.php [L] So that I wouldn't have to update my .htaccess file whenever I wanna add a new page to my...

FreeBSD Server .htaccess issues

Server Details: FreeBSD PHP Version 4.3.11 Apache Appache Modules: mod_throttle, mod_php4, mod_speedycgi, mod_ssl, mod_setenvif, mod_so, mod_unique_id, mod_headers, mod_expires, mod_auth_db, mod_auth_anon, mod_auth, mod_access, mod_rewrite, mod_alias, mod_actions, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status, mod...

Restricting access to images on a website

I'm putting together a portfolio website which includes a number of images, some of which I don't want to be viewable by the general public. I imagine that I'll email someone a user name and password, with which they can "log-in" to view my work. I've seen various solutions to the "hide-an-image" problem on line including the following,...

htaccess problem with filename

Hi, when I first set up my site I decided to add index.html to the URL but now I have problems with when people remove the index.html and try and access the folder... For example: RewriteRule ^archives/([0-9]+)/([0-9]+)/index.html archive.php?mid=$1-$2 So when archives/07/2009/ it will cause an error, how can I avoid this error? Che...

Using .htaccess to control HTTPS on certain pages

I've got a site that requires (obviously) HTTPS for checkout. The current fix put in place involved making the whole site run in SSL mode, but this is causing problems. How would I change this... RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L] To only set a certain URL (say basket.php) as HTTPS? ...

Hide video and mp3 files

I am coding a site that has video and audio files, I need people to be able watch/listen to the files if they are logged in php/mysql login but I don't want people who haven't register to be able to download the files, I need to be able to block direct access to the file and only let them access by the user with accounts. ...

RewriteCond and RewriteRule in .htaccess

I have a client folder located at http://www.example.com/client However, I've now installed SSL on the server, and want to add a permanent redirect using HTACCESS so that whenever /client is accessed, that it redirects to: https://www.example.com/client Anybody know how to do that? I've redirected my domains in the past like this: Rew...

301 redirect .htaccess

Im trying to request the following entire site 301 redirect: word.something.blah.domain.com --> http://www.word.com I don't know how to write the 301 redirect rule. Can someone help out? ...

Removing the query string for SEO improvements.

I just came across this: http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html --> check under "removing the query string". It states: "On many sites, the page will be displayed for both page.html and page.html?anything=anything, which hurts your SEO with duplicate content. An easy way to fix this issue is to redirect extern...

htaccess Rewrite issue

How could I use a rewrite to change: /?tag=foo To: /tag/foo I tried: RewriteCond %{QUERY_STRING} ^tag=(.+)$ RewriteRule ^(.*)$ http://www.example.com/tag/$1 [L] But it did not work. ...