rewritecond

htaccess querystring to multiple paths

I've got a site with the following .htaccess rule: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?id=$1 </IfModule> It works great but I need to expand it so that IF there is another path taken by the user, I can forward it (but the root p...

how to restrict website access to a couple of web pages and ip address only, using htaccess.

Hello Using following Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_URI} !/temp_page.php$ RewriteCond %{REQUEST_URI} !/thanks.php$ RewriteCond %{REMOTE_HOST} !^90\.333\.222\.111 #RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1 RewriteRule $ /temp_page.php [R=302,L] can allow myself (ip) to view all pages, and other get...

[Apache] Rewrite Logic, is there a better way to do this?

I'm curious, is there a more efficient way to do the the following? Right now it works great, just seems like overkill... RewriteEngine On RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteCond...

URL Rewrite to remove parameter but send it

I currently use register.php?referal=gamestand on my website so that when the user visits my website through the referal website, I can track how many players have registered from that place. referal=gamestand will automatically fill in an input textfield within the registration process using echo $_GET['code']; The problem is... on Go...

RewriteEngine: subdomain to index.php, how?

Days later I asked about redirecting dynamic directories to index.php, and I got this code that works perfect (it's the only code I have in .htaccess): RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule (.*) index.php This translates urls like http://mydomain.example/dynamicdir/ to http:...

htaccess problems with redirect for no www

I've been trying everything to manage a redirect from www.domain.com to domain.com, but nothing seems to work for me. I always get a redirect loop - and I've tried various things I found here or on Google. So here is my .htaccess, maybe someone could help me figure out what I can do to redirect correctly or if there is something wrong i...

Help with .htaccess

Hello I need help with .htaccess I was using RewriteCond %{REQUEST_URI} !^/unsubscribe(/.*)?$ [NC] that to make a folder load without affecting of RewriteRule ^([0-9]+) view.php?id=$1 [NC] I want rewrite the rule to make a folder independent without doing of other rules into that folder Current code to do so is : RewriteCond %{REQUE...

simple RewriteCond in .htaccess

OK, it sounds simple, it looks simple and it weighs simple. But it's not. I can't for the life of me get this working. Let's say I have this URL structure: http://www.test.com/%action%[/%param1%/%paramX%] I need to redirect (actually I want a REWRITE) to: http://www.test.com/index.php?option=com_%action%&amp;param=[%param1%,%p...

Subdomain Rewrite Logic

Hello, I have the following Rewrite Logic, and it's working to redirect the subdomain, partially. If I visit the URL http://subdomain.clientcollabhq.com/some/path it redirects properly, but if I visit http://subdomain.clientcollabhq.com/ it skips the RewriteCond blocks for the subdomain and falls into the fallback RewriteRule. Any idea ...

Htaccess RewriteCond for the target file

I have a script that generates images having such urls: /photo/XXXX/W/H where XXXX an id of image, w - width and h - height there is no directories called photo/XXXX on webserver document root. Now I created directory /cphoto and script caches images to that folder. Once script launches it generates static image in folder /cphoto with n...

Abusing Mod Rewrite for a clean file system, and pretty URLs.

I have a few php files that do a few different jobs. I'd like to change the way my clients access these php files to make it more clean for the end user. The Mod_Rewrite system has shown that it can do some pretty powerful things when in the hands of the right server admin. So I was wondering how far can you abuse the Mod Rewrite rules f...

Multilanguage site, subdirectories as language (RewriteRule)

Hi all, For my website i want to rewrite my url to: www.xxx.com/en/index.php instead of www.xxx.com/index.php?language=en www.xxx.com/nl/index.php instead of www.xxx.com/index.php?language=nl www.xxx.com should be www.xxx.com/en/ This actually works i have added these rewrite rules RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www\...

HTAccess Rewrite Needed

I need to rewrite any url on my domain that starts with /club/anyPage to /page/club/anyPage. For this, I believe I can use the following command: RewriteRule ^club/([^/]*)$ /page/club/$1 [NC] Also, if the physical page does not exist I want it conditionally rewritten like so: /club/$1 to /page/club/club.php?title=$1 So in this ...

Simple RewriteRule question

Hi all, This seems so simple, but I can't figure it out... I would like all requests to be rewritten to index.php (which will interpret the request) apart from 404.html which should be rewritten directly to 404.php. The following code does work at rewriting everything to index.php, but 404.php never gets triggered. I have left line 3 ...

How to redirect "/" to "/home.html" only if the file "/index.html" does not physically exists?

Hello everybody, I found a way to redirect (not load, but change the URL) "/" to "/home.html". And now I want to add a RewriteCond to avoid the redirection if the file "/index.html" exists. I tried (without the comments), but it didn't worked : # We check that we comes from "domain.tld/" RewriteCond %{REQUEST_URI} =/ # We check that ...

.htaccess: Check file existence after RewriteRule

If have some rules in my .htaccess: RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l RewriteRule ^.*$ - [NC,L] RewriteRule ^assets/img(.*)/([a-zA-Z0-9-_\.]*)\.(.*)\.([a-z]{2,4})$ /assets/img$1/.$2.$4/$3.$4 [NC,L] This causes /assets/img/path/image.jpg > /assets/img/path/image.jpg The second rule: /assets/im...

mod_rewrite local redirect on hostname

Hi, wonder if you can help me, I've got a hosting account (on GoDaddy for my sins) which has one domain name associated with it and a few more parked. If I visit: site1.com site2.com site3.com I get the contents of /httpdocs/ I want to redirect to a sub directory (locally) only so that if you goto site2.com, the URL stays as site2....

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 questions

Say I have the following .htaccess file: RewriteEngine On RewriteCond %{HTTP_COOKIE} name=value [NC] RewriteRule ^image01.gif$ http://www.domain.tld/images/partner/image01.gif [NC,QSA] RewriteCond %{HTTP_COOKIE} name=value [NC] RewriteRule ^image02.gif$ http://www.domain.tld/images/partner/image02.gif [NC,QSA] What do NC and QSA mea...

RewriteCond thinks existing file does not exist

I want to achieve my /assets/img urls are rewritten to a specific location when that file exists, but otherwise to a php script. Therefore I have these rules: RewriteCond %{DOCUMENT_ROOT}assets/img$1/.$2.$4/$3.$4 -f RewriteRule ^assets/img(.*)/([a-zA-Z0-9-_\.]*)\.([^/]+)\.([a-z]{2,4})$ assets/img$1/.$2.$4/$3.$4 [NC,QSA] RewriteRule ^ass...