mod-alias

How do I use .htaccess to redirect to a URL containing HTTP_HOST?

Problem I need to redirect some short convenience URLs to longer actual URLs. The site in question uses a set of subdomains to identify a set of development or live versions. I would like the URL to which certain requests are redirected to include the HTTP_HOST such that I don't have to create a custom .htaccess file for each host. Ho...

Using Alias in Apache ONLY if local directory not present?

Hey all, We're running a reseller web host, and aliasing a particular directory for ALL the sites within. This is all happening through WHM/Cpanel, which could possibly complicate my question. We want all hosts to run their "/concrete" directory through a shared location on the server. This is working fine by adding "Alias /concrete/...

mod_rewrite or mod_alias ?

I have a server, it's httpd.conf already has some "RedirectMatch permanent" directives in it. I'm not that familiar with mod_alias, I've only ever used mod_rewrite. What's the basic difference? I don't see a "L" flag in mod_alias to stop processing rules. Which one should I use for best practices of redirecting from one subdomain to ...

How to use htaccess to redirect all but one subdirectory

It's been a while since I've messed with .htaccess and I can't seem to get this quite right. I have a site, say example.com, where I want example.com/* to redirect to example.com/collector.html except for URLs under the subdirectory example.com/special, which I want to continue working. For example: example.com/page.html should redire...

Redirect 301 Transfer to New Domain Output URL is Ugly

I am moving my blog to a new domain. I am trying to do this through .htaccess. While the redirect is okay - the output URL is 'ugly' example in old domain .htaccess file: redirect 301 /archives/2009/06/02/hello-world/ http://indiapoint.net/archives/2009/06/02/hello-world/ So if we click http://www.i3pep.org/archives/2009/06/02/hello...

mod_alias AliasMatch Regex - matching everything in a folder except two patterns?

I'd like to use AliasMatch to create an alias for everything within a folder, except for two (or more) specific regex patterns. For instance the following AliasMatch creates an alias for everything in the 'content' folder: AliasMatch /content(.*) /home/username/public_html/$1 But there are two regex patterns that I don't want the abo...

Apache - Redirect 301 pdf to pdf with spaces ( binary file )

What I want: To 301 redirect /file_new.pdf to /file new.pdf ( %20 aka space between file and new ) I'm aware that: I can rely on RewriteRule 301 which uses mod_rewrite, using a solution from this thread: @ http://stackoverflow.com/questions/410811/modrewrite-with-spaces-in-the-urls I can rename the file to not include spaces...

Impossible to mod_rewrite based on existence of file in mod_aliased directory?

I'm trying to do something like the following in my .htaccess file: Alias /assets /location/of/files RewriteCond %{REQUEST_URI} ^/assets/[0-9]+.jpg$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* /build_thumbnail.cfm?path=%{REQUEST_URI} [QSA,L] So in theory it's quite straightforward: an image is requested from a url starting w...

mod_alias subdirectory replacement

I am using RewriteMatch to redirect all traffic from subdir1 to subdir2, while keeping all other parts of the url the same. So for instance, http://www.mydomain.com/subdir1/ would redirect to http://www.mydomain.com/subdir2/ I am using this rule: RedirectMatch 302 /subdir1/.* /subdir2/$1 which works for the url http://www.m...

How to use spaces in the URL path in mod_alias’ Redirect directive?

Following on from link text, I've also got problems with file paths that contain spaces. I was told to simply enclose the full path in quotes, and that should work, but I keep getting this page marked up in my Webmaster Tools error log as not being found: redirect 301 /"News/Press Releases/Press_Release_Update_Oct_2006.pdf" /index.html...

Issue with redirection of a folder with mod_alias

Another question following on from this thread. The only remaining item that I can't solve is that there is a listing for an now non-existent folder '/team/', but if I add this into my .htaccess file, it breaks all other .htaccess entries for files in that folder, i.e. redirect 301 /team/ /team.html redirect 301 /team/joe_bloggs.htm /t...

How to ensure that Apache always serves a single page via HTTPS?

I would like to redirect all connections from htt_p://www.example.com/abc.html to HTTP_S://www.example.com/abc.html . What mod_alias or mod_rewrite commands would work for this? I've tried: RewriteEngine on RewriteCond %{HTTPS} =off RewriteRule $abc\.html^ https://www.example.com/abc.html [R] in both .htaccess and httpd.conf but that ...

How can I redirect directory using htaccess including files with spaces in the names

Hi, I am dealing with a situation where someone has handed me a bunch of old files on the server which already have a lot of incoming links directly to them (mostly pdf files). I now have the files organized but in a different directory. Before it was 'domain/manuals/file' now it is 'domain/media/manual/file'. I am trying to resolve this...

Apache Rewrite & Alias combined

Hello, We have run into an issue where we have an existing Alias, and we would like to add a rewrite rule to catch all variations of case-insensitive spellings, ie: URL: http://www.example.com/example Alias /example "/var/www/html/web/example" We need a rewrite rule to catch: /ExamPle /exampLE /eXAmple etc ... If anyone could...

.htaccess why problem when using ? in Redirect.

i have this line Redirect /?page=cms_page&id=12 http://www.domain.dk/case when i type ?page=...... its not will work if i only use page=..... its will work fine but not the user type domain.dk/?page=cms_page&id=12 So now i ask you guys what have i make wrong? ...

How can I get mod_rewrite and mod_alias to work together?

I have a Windows/Apache/PHP environment set up to imitate a shared hosting account but cannot get mod_alias and mod_rewrite to play nicely with one another. Both are definitely enabled at the server level and on a per-site basis. I have d:\web\public_html\ set up as DocumentRoot. But generally speaking it will be empty. I have d:\web\s...

Fixing mod_rewrite and mod_alias conflict

I have a VirtualHost setup like this : Alias /somedir /some/other/dir http://example.com/somedir works fine However, I need to setup mod_rewrite for /somedir (a CodeIgniter app for which I want clean URLs). Here's the bit from the CodeIgniter wiki : RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQ...

Simple 301 redirect in .htaccess with query string does not work with Redirect directive

I am trying to redirect a single URL in a .htaccess file with Redirect: Redirect 301 /index2.php?option=com_rss&feed=RSS2.0&no_html=1 /something/somethingelse/ I have a bunch of other similar rules which work using directory structure URLs, but this one refuses to get processed. Redirect 301 /old/url/ /new/url/ Do I have to do anyt...

Redirect from one domain to another, without the user realizing it

Hey I have a bunch of domains on on of my servers. I'd like to be able to redirect some domains to a different domain without the user knowing, so not a 301 redirect. An example, redirect domain.com to masterdomain.com/sites/domain.com. So when visiting domain.com, the user would be displayed with the data on masterdomain.com/sites/do...

.htaccess alias URL

Hi I am trying to create a redirect of a temp URL using Redirect Permanent /dir/subdir http://www.domain.com/other_dir/htmlfile.html Note that "dir" exists in the file structure but "subdir" does not. In the browser if I type http://www.domain.com/dir/subdir the redirect works (even though, again, "subdir" does not exist) but http:/...