mysite.com/new redirects to mysite.com - .htaccess

I just rebuilt my site to be responsive with Gantry 5 and Joomla. built in inmotion hosting server. moved it into a sub domain on my real sites server, www.umiultrasound.com/new. when i try to access the site to test it redirects to www.umiultrasound.com.
I have discussed this with my host, they say i have a wildcard redirect- i don't. they say to check my .htaccess file. i did but i do not see where i am redirecting / or www.mysite.com to itself.
they then recommended that i read one of your forum results. the one they sent didn't apply to me. hoping you can help

Check for any RewriteBase command in .htaccess. You could also temporarily copy the standard htaccess.txt over .htaccess to see if this makes any difference (backup .htaccess to .htaccess.old or similar first).
Also check your configuration.php file to see if the live_site parameter has been set.

Related

Trying to obtain images from another location but RedirectMatch in htaccess is ignored

I've just setup a new subdomain 'preview', ie preview.example.com and I am setting up a replicate of the codebase of a live website (from the www. subdomain) so that I can have a duplicate environment for testing and showing my client recent changes.
I want to save myself having to copy over all the images to the preview and so the normal location under which images are saved in a WordPress site /wp-content/uploads/ is empty. I wanted to ues a simple htaccess rule to get these instead from the live subdomain where the image at the same path will exist. In other words, a request for
https://preview.example.com/wp-content/uploads/2021/01/test.jpg
would be redirected to the following where the image exists..
https://www.example.com/wp-content/uploads/2021/01/test.jpg
I've tried to set this up with the simplest of htaccess redirect rules but it just seems to be ignored and I've no idea why. Any idea how I can troubleshoot this?
RedirectMatch 301 /wp-content/uploads/(.*) http://www.example.com/wp-content/uploads/$1
Converting my comment to answer so that solution is easy to find for future visitors.
Scenario is that both subdomain and main domains are on same host but their DocumentRoot are set to different paths. OP wants to serve lot of images from subdomain but doesn't to do bulk copy.
Suggested approach without tinkering with .htaccess is to create a symbolic link of wp-content/uploads/. Only option suggested to use in .htaccess is:
Options +FollowSymLinks
Which allows use of symbolic links for serving web requests.

How to STOP redirecting my website to mobile.mywebsite.com in smartphones

I have developed a website www.mywebsite.com and it is ready to go live.
I have used Codeigniter framework.
When I enter www.mywebsite.com from any android/iphone, it redirects automatically to mobile.mywebsite.com and displays page not found error. I dont have any mobile site developed for this. I want to show the main site even on the smartphones.
I am not good at .htaccess file, and I am using default .htaccess to remove the index.php in the url.
I tried creating a subdomain mobile.mywebsite.com and pointed to root path. But same response. I search online, but didnt find anything on how to STOP redirecting.
Thanks in advance.
When I was uploading my local files into the server I was NOT overwriting the old ones assuming the folder is clean and no need to overwrite. But my hosting provider has default .htaccess which is redirecting to the mobile site.
I deleted the old one and gave my .htaccess without the mobile redirection and everything is in place now

.htaccess - Masking and redirecting to a subdirectory on a different server

I'm looking for some help with my .htaccess file.
In short, I have a bunch of content up in the subdirectory www.myserver.com/forum/ (this directory is not my choice and cannot be changed), which includes both a forum (myserver.com/forum/forum) and a wiki (myserver.com/forum/wiki) and this is abviously not an ideal layout. I do not own myserver.com and there is content there that is not mine, though I have full access to the entire server.
I also have a domain name www.mydomain.com, which I want to redirect and mask such that if a user goes to mydomain.com/<something> they will be shown the content from myserver.com/forum/<something> while still being shown mydomain.com/<something> in the address bar.
One other thing I'd like to see, although it isn't vital, would by for a 404 generated by someone typing in mydomain.com/somethingThatDoesNotExist should redirect to mydomain.com/404.php instead of myserver.com's default 404.
I've tried a number of different approaches and searched extensively for the past day or so online - I'm sure that the answer is even here on SO somewhere, but all of the guides/examples I've tried have not worked and I feel like I'm going in circles.
Many thanks in advance.
EDIT: And I do know for sure that .htaceess is enabled.
if a user goes to mydomain.com/ they will be shown the
content from myserver.com/forum/ while still being shown
mydomain.com/ in the address bar.
First thing you need to understand that this is ONLY possible if mod_proxy is enabled on the Apache server of mydomain.com.
Once you've enabled mod_proxy, mod_rewrite and .htaccess through httpd.conf on mydomain.com, put this code in its .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteRule ^(.*)$ http://myserver.com/$1 [L,P]
I will have to think little more about your 404 requirement, but if you get this working I am sure we can find a workaround for that as well.
You could do some proxying with PHP or whatever other language they allow..
Take a look at file_get_contents behind a proxy?

pointing to a subfolder from a subdomain

My main site www.mysite.com is using drupal
I would like to create a WP blog at blog.mysite.com (I know I can create a blogging platform using drupal but don't wanna do that, WP is best for blogging it simply rocks)
I'm quite new to .htaccess and was wondering if there's a way to get
www.mysite.com/blog pointing to blog.mysite.com (since mysite.com/blog is better for SEO)
(but not redirecting there, it just has to load from there, so visitor sees mysite.com/blog in their browser)
If you have mod_proxy enabled, you can use the [P] flag to internally proxy www.mysite.com/blog requests to blog.mysite.com. In the htaccess file for www.mysite.com's document root (above any drupal related rules):
RewriteEngine On
RewriteRule ^/?blog/(.*)$ http://blog.mysite.com/$1 [L,P]
If you don't have mod_proxy, you may need to setup WP somewhere in the same document root as your drupal site (like in /blog/) and get wordpress to work in a subdirectory. I've had mixed results in getting that to work with another CMS so not sure how much help I can give you there.
gvanto:
Thanks. I don't have mod_proxy but I think it may cause issues having it under a subdomain and accessing in this fashion (e.g. what will all the internal links be pointing to?). The 2nd option of having it in a subfolder is probably best: http://drupal.org/node/877828

re-direct / re-write my domain

First, I have already spent the past few hours trying to find a solution for this, but have had nothing but non-working solutions :(
It's pretty simple - I'm pointing the DNS of a new domain to my current hosting, but when I visit the new domain, I'm just viewing my original site (the one i got with my hosting).
Let's say my original site is "www.originalsite.com" - the content for my new domain is at "www.originalsite.com/newsite.com/" (dots included).
Now I just need to get "www.newsite.com" to re-direct to it's own directory AND re-write itself to hide the directory name.
So yeah, "www.newsite.com" needs to use the content in "www.originalsite.com/newsite.com/", but remain displayed as "www.newsite.com" in the URL bar.
Cheers for any input - really appreciated :)
PS: I'm using ColdFusion and previously made a useful re-direction, but the result was typically "www.netsite.com/newsite.com/" - which is not what I want :)
Oh...and yeah, I'm hoping for an .htaccess fix :) thanks!
If you have full control over the server, a VirtualHost in httpd.conf is probably a better solution. For example:
<VirtualHost newdomain.com:80>
ServerName newdomain.com
ServerAlias www.newdomain.com
DocumentRoot /path/to/webroot/newsite.com
</VirtualHost>
If you don't have the ability to do this directly, any good host will provide a "Park Domain" function which allows you to achieve the same effect - specifying your new domain and identifying which directory you want it to point to - via the web control panel.
However, if you don't have the ability to do that, here's a mod_rewrite for .htaccess that should work:
RewriteEngine On
RewriteCond %{REMOTE_HOST} (www\.)?newdomain\.com
RewriteRule ^(.*)$ /newdomain.com/$1 [L]
CrystalTech have just recentely installed a mod that provides htaccess ...
Though they've only done it one server so far :) so I'm being moved onto that server.
Problem solved I guess - heh!
PS thanks for the help anyway guys :)
You could do the redirect with a "cloaked" frame page.
That way the URL in the browser's address bar stays the same (no extra path), and it remains simple to use the subdirectory.
The following link describes this for classic ASP - but it should be simple to convert to any server side scripting language/platform:
http://www.simpledns.com/kb.aspx?kbid=1151

Resources