.htaccess

Redirect all page on a domain to one file

Hello, I am looking to permanently redirect all the pages on a domain to one page on the SAME domain, using htaccess/mod_rewrite. Basically I want any page requested for the domain to return a holding page [ which is index.php] at domain.com/ most of my attempts so far are causing errors as they are throwing the server intoa loop. T...

htaccess and redirecting sub-domains

Hi I am creating a site with some vanity url's i.e. http://www.domain.com/Email What I'd like to do is use htaccess to redirect any subdomain i.e. the /Email to the main domain.com where an index.php will record what the subdomain is. Is this possible or am I making this up? ...

Redirect URL with RewriteRule if php url has parameters?

Hi, I'm trying to use rewrite rules in my .htaccess to take user from an old link to a temporary new link (it's not a permanent new site, so I don't want a 301 redirect) The following works for all the html pages and also the php pages without parameters, but it doesn't process the last example - a php page with parameters. Note that t...

Rewrite .htaccess regex url

I have an .htaccess file with this: (I didn't write it) RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?bla=$1 [L,QSA] Problem URL http://localhost/index/test The "index" part seems to match "index.php" that's in a web dir and Rewrite fails. Question: What's wron...

Force 'www.' through .htaccess except certain files

Looking to redirect all traffic from http://example.com/ to http://www.example.com/ The catch is I have a few files that can't be redirected to http://www.example.com/ So example: http://example.com/ to http://www.example.com/ http://example.com/test123 to http://www.example.com/test123 http://example.com/ip to htttp://example.com/i...

.htaccess and custom ErrorDocument for different file types.

I'm wondering if it's possible to use mod rewrite along with the ErrorDocument deceleration to customize the error pages depending on what type of file is requested. For example a non-existent html or php file is requested Apache will give nice custom HTML page. But if a non-existent image, js, css, etc... file is requested then Apache...

url rewrite problem wamp

hi i have login.php , for that i have created the url rewrite in the .htaccess inside the login folder , RewriteEngine On # Turn on the rewriting engine RewriteRule ^login$ login.php [NC] # Change feed URL but nothing happened , what i do now , am using wamp.. ...

Set HTTP header for all PHP scripts via .htaccess file

Hi to all gurus, I code same lines all PHP programs at one of my projects. Is it possible to do this at .htaccess for a directory? And how? PHP codes: Header('Content-Type: application/xhtml+xml; charset=utf-8'); Header("Cache-Control: no-transform"); Thanks any help. Best regards. Yusuf Akyol ...

RoR: Store HTTP_AUTHORIZATION in session to access .htaccess protected folder

Hi everyone, In my Ruby on Rails application, I am trying to protect part of the public folder using apache .htaccess feature to prevent access from files to non-authentified people. So I have place a .htpasswd file to protect this folder and set up apache accordingly and this work... prompting me for login/password to access the files....

Only allow certain (dynamic) IP's to visit website director

OK I have 4 dynamic ips, in order to get those IP's I need run a gethostbyname('domain_name.com'); on 4 domain names I have that alwasy resolve to the only 4 IP's that are allowed to access this directory. This is very easy for me to do on a PHP script on a page, but I am confused as how I can do it to a directory? Thanks!! ...

create subdomain address of subdomain that does not exist, to redirect to the main domain

Would it be possible to set a 301 redirect for sub.domain.com to redirect to domain.com/directory even when the subdomain does not exist. ...

Combine URL rewriting (to force https) with http auth?

I have a domain, mattpotts.com and have set up a sub-domain dev.mattpotts.com for me to develop on and will then copy the files to the normal domain when they're ready to go. My directory structure is as follows and dev.mattpotts.com points to dev/ +-public_html/ +-project1/ +-project2/ +-project3/ +-dev/ +-project1 +-p...

.htaccess redirect all filenames matching...

I want to redirect certain filenames to a different filename for a site regardless of directory. The idea is I have a cached, versioned filename for production, but when I am working on the file in development I want my local files without having to rename all references. For example, styles-0.1.min.css would redirect to styles.css of t...

Setting up cakePHP on shared host and remove /app/ in URL

Hello, I've installed cakePHP on a shared server where I can't set the Apache webroot, so it's currently pointing to /public_html. In that folder I have /cake, /app, /vendors, etc. Everything works fine; the only problem is that rather than links to controllers/actions being www.mysite.com/controller/action, there is an addition /app/ i...

Mod_Rewrite Trailing Slash Issue Problem/Question

Hello. I am trying to lock a client out of a PHP application I created them but, still allow them a "virtual" access to the doc root using: RewriteCond %{DOCUMENT_ROOT}/ftp/%{REQUEST_URI} -f [OR] RewriteCond %{DOCUMENT_ROOT}/ftp/%{REQUEST_URI} -d RewriteRule ^(.+) /ftp/$1 [L] This works like a charm when a user goes to: http://domain...

mod_rewrite empty REQUEST_FILENAME

I have this in my .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule !\.(gif|jpg|png|css|js|ico|flv|php|txt)$ index.php Now i need to add another rule that will forward to index.html if no REQUEST_FILENAME is found. So www.mysite.com would forward to index.html and www.mysite.com/file.html would forwar...

wordpress .htaccess with permalinks

I have a permalink working but as soon as I create a post it tells me that soory post not found permalink setting is to "/%pagename%/" and here is .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /ryan/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d R...

How to rewrite if exists a php file with the same name?

Hello, I was searching in Google this question very much time but I don't find any answer. I want to rewrite http_//mydomain.com/f to http_//mydomain.com/ This is my .htaccess code: Rewriterule ^f$ / [R=301,L] rewrite works, but if exists a file called f.php, then doesn't work I tried to do this: RewriteCond %{REQUEST_FILENAME} !-...

Simple .htaccess rewrite ?

Hi guys. I forgot how to do that and I am stuck. I have a site say www.example.com and another folder www.example.com/docs/ I want when some one visits the www.example.com/ he will be redirected secretly to www.example.com/docs/ but still see in the URL www.example.com And even if the user types www.example.com/docs/ I want him to see w...

Wordpress permalink on IIS server

I have a WordPress Install on an IIS server using Helicon APE to emulate .htaccess config I have the standard wordpress .htaccess to setup the url rewriting However, as far as I can tell, wordpress then use the server variable ( echo $_SERVER['REQUEST_URI'] and/or $_SERVER['HTTP_X_REWRITE_URL'] ) to now what page to serve. As both var...