.htaccess

Htaccess help, $1 being used before its set??? what?

I have this snippet RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|images|img|css|js|robots\.txt) RewriteRule (.*) index.php?/$1 [L] It won't allow me to access a file at website.com/js/main.php but it will let me access index.php According to my webhost, $1 is...

htaccess mod_rewrite help

i have a domain with a website in a folder. i.e http://domain.com.au/website/page.php i only have access to .htaccess files to make the rules. i would like my url to look like this.. http://domain.com.au/page so in essence i want to drop the subfolder its sitting in, and the php extention. All links in my php are structured like thi...

Remove .htaccess in subdirectory

I have the following .htaccess file in a directory: RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://www.mysite.com/launch [R,L] DirectoryIndex index.html Basically, this forces any and all pages below mysite.com/launch to an SSL version of https://www.mysite.com/launch/index.html. However, for a single sub-dire...

Help me rewrite this htaccess rule

How do I rewrite this rule to redirect everything back to the index or server_root? If there is a request for say, www.site.com/articles/some-article.php, the somearticle.php should be re-routed back to the index page. I also don't want to have the url showing the "index" portion of the URL. site.com/index is where everything should be ...

How do I redriect a CPanel IP address to a domain?

I've got a duplicate content issue where there's two instances of my site indexed in google: the first is the actual domain: http://domain.com the seconds is my WHM/CPanel preview of the account: http://123.456.78.9/~/domain Is there any way to redirect the IP version to the real domain? ...

how do i hide /magento/ in my site's url?

A site has an existing system (lets call it mysite) and the client asks to put in magento. My directory structure goes something like this: ROOT -index.php (this is the app's main controller) -.htaccess /blog (runs wordpress) /assets (current system's media folder) /magento (this is where all magento files go) P...

Is there a way to create subdomain like url redirection using .htaccess?

Hi, I want to write a .htaccess from which the following action should be done. I have domain like www.xyz.com and am putting many articles on that. so it wil become www.xyz.com/article1-tutorial/ www.xyz.com/article2-tutorial/ www.xyz.com/article3-tutorial/ But instead of that i need like this. www.article1-tutorial.xyz.com...

Domain specific htpasswd conditions

I am using a wildcard dns system that routes all subdomains through a single web app and sets a userid based on the first part of the URL (X.domain.com where X is the username). I now want to edit my htaccess file to enable conditional httpauth using htpasswd for specific domains. e.g. if url = password.domain.com the enable httpauth. ...

htaccess problem with Chrome, but not Safari?

I have a very simple .htaccess file set up to redirect a 404 to a php script: ErrorDocument 404 /404.php This works as expected in Safari, but does not work in Google Chrome (on a Mac or a PC). I have also put a 404.htm file to see if the php script was the problem, but had the same results. Why would Chrome have a different experie...

htaccess and no www

I am trying to redirect my whole site to non-www here is the htaccess code I am using # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress # no www RewriteEngine On RewriteCond %{HTTP_HO...

.htaccess mod_rewrite for nested folder structuring

Hello, I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2 [NC] Only thing that is driving me crazy right now is if I want to be able to have the 2nd directory or not. Like: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2 [...

How can I redirect one wordpress install to another (both in subdirectories on the same domain)?

Pulling my hair out over this one. I have one wordpress install at /2009 and one at /2010. I am trying to redirect all requests to the 2009 site to the 2010 site. I have tried both of these in the root .htaccess and in the /2009 .htaccess: RewriteRule ^2009.*$ 2010 [R=301,L] RewriteCond %{REQUEST_URI} ^2009.*$ RewriteRule . 2010 [R=3...

HTML Base Equivalent in .htaccess?

Let's say you have the following setup. You have a server with the basepath set to the normal webroot. The server has files in the following structure /projects /some-unique-id /index.html /images /some-unique-id /index.html /images Is it possible to have a .htaccess file somehow redirect the...

Domain Redirection While Maintaining Original URL

I have two domains ("this_site.com" and "that_site.com") that I want to point to the same place (same set of files). BUT What I really want to do is maintain the original URL in the address bar while the visitor accesses the different pages. Example: The primary domain holding the web files is "this_site.com". If I type in "that_site....

Ajax response call, 404 Not Found

Hi, i tried to use wordpress and codeigniter for a intelligent join between the best CMS and the best PHP Framework. Actually i intended to use codeigniter for database managemnent and wordpress for display. But i wanted to use codeigniter inside wordpress. So, i have a file tree like that: www - codigniter-core folder - .htaccess - ...

Redirect Form Get Request With RewriteRule

Okay, so I have a website where the user can put a search query into a form that uses GET to send the data. When it gets sent, the url looks like: /recipes.php?query=taco&ingredients=chili And I would like to rewrite it to look like: /recipes-taco-Ichili.html So I added the following line to my .htaccess file: RewriteRule recipes\.php...

What is a mod_rewrite rule to turn *.html to *.php?

I need a rewriterule so if i type index.html i will show index.php I mean i have files like, home.php, about.php and i want to be able to access them with .html too Thanks in advance ...

How to stop strings appending to URL rewrite?

Hi, I've implemented a simple .htaccess to rewrite any request on a particular directory. It works to an extent. If you request with nothing after the trailing slash, then it redirects fine. If you put anything after the trailing slash, it is appended to the end of the URL you're trying to re-direct to. For example, You request: /...

How do I deny access to invalid web subdomains with .htaccess?

The following .htaccess file does not work: SSLrequireSSL RewriteEngine on RewriteCond %{HTTP_HOST} !^secure\.neuralfutures\.com [NC] RewriteRule (.*) - [F] I'm trying to prevent access to anything but "https://secure.neuralfutures.com/docs/", i.e. "https://www.neuralfutures.com/docs/" will fail. I also seem to be running into cachi...

mod_rewrite and relative urls

I'm setting up some simple url rewriting rules using mod_rewrite and a .htacces file, but I've got some problems. If I set up the .htacces this way: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule /index.html /index.php [L] when I call from the browser this url: http://localhost/~dave/mySite/index.html I got a 404...