I have a development server that has Ubuntu server 10.10 with an ip of 192.168.0.175.
When I enable the rewrite mod for apache2 and change the site config to allow rewrite then things get all messed up.
With rewrite turned off and allow rewrites to None then I type in 192.168.0.175/test and the site loads, but with it all turned on it changes the address to www.192.168.0.175/test and the site does not load.
Why is this happening?
www.192.168.0.175 is wrong. If you type www the browser assumes that is a domain name.
The Ip's should be prefixed with www
Related
I'm working on an old website and I've just found something strange. Www.mysite.com redirects to www.test.com, while mysite.com (non-www) redirects to www.other-site.com.
I've checked the htacces, and it only contains rules to redirect traffic to test.com. www.other-site.com is not present in the file. So how is it possible? Where should I check if there's a rule for this redirect?
Environment:
Centos server /
Apache /
Three sites are on different servers
This could be a DNS issue. If both www.test.com and test.com point to the same server then it is all server side. Virtual hosts can sometimes be the problem if you have Apache set that way then you will need a Virtual host for both www.test.com and test.com. I would say start with the DNS, then the apache config, then the site folder.
Hope that helps.
I have two internet addressess, say one.com and two.com
The content of my webpage is all under the domain one.com. If I hit address two.com I want it to redirect to one.com but still with address two.com. For example if I type in address bar two.com/article. I want to still show this same address but the content displayed would be as from address one.com/article
I tried to use htaccess file, but still no luck.
Any advice would be appreciated.
You can't achieve that while performing an external redirect.
If both domains are hosted on the same server, then you can perform an internal redirect (e.g. using Apache's Alias, AliasMatch or mod_rewrite).
If the domains are hosted on different servers, then you would have to proxy one of them. You could do this with ProxyPass from Apache's mod_proxy.
Go to your domain name provider and create an alias (CNAME record) for the address.
You will need to enable mod_proxy in your Apache config for that. Once mod_proxy is enabled, enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory on domain2.com host:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain2\.com$ [NC]
RewriteRule ^ http://www.domain1.com%{REQUEST_URI} [L,P,NC]
I've recently installed magento to a new server. The domain name has not been pointed to the server yet because I still need to design the site, so for now I'm using an IP address.
Example:
11.222.3.44/~clientname/
I'm trying to turn on magento's url rewrites to remove "index.php" after "/~clientname/" on every page, however when ever I turn rewrites on the site stops working and I get a 404. Would this be due to the IP address and the trailing client name I'm using? If so, how can this be corrected?
Any help is greatly appreciated!
Check if the RewriteEngine is On, RewriteBase is ok in the .htaccess. In your case it should be RewriteBase /~clientname/
And of course check that the mod_rewrite is installed and enabled but I think it's already done.
Redirecting to different server but same domain.
I have 2 servers on different hosts. One has domain.com and the other domain.org. domain.org has more resources. Now i want to create a sub domain on the first one (sub.domain.com) and redirect to (sub.domain.org) whiles maintaining the .com in the urls.
Thanks.
It depends on what's your hosting running on (Apache, nginx etc...).
In nginx you can use proxy_pass to redirect request to another host while still preserving url:
location / {
proxy_pass http://domain.org:80;
proxy_set_header X-Real-IP $remote_addr;
}
Take look at nginx docs for more info: http://wiki.nginx.org/HttpProxyModule
Or this discussion can be helpful: http://www.webmasterworld.com/apache/4464836.htm
It may be possible to also do this by manipulating DNS records so sub.domain.com is resolved to host where subd.domain.org is running (but you need to handle HTTP Host header in webserver)
There are several ways to do it:
You need to create DNS alias aka CNAME record for sub.domain.com for redirecting to sub.domain.org (look here ( http://en.wikipedia.org/wiki/CNAME_record ) for more info). You won't need to do any moves on .com server.
You can redirect with web-server configuration. So sub.domain.com will refer to .com server and web-server will redirect it to .org. For example virtual host in apache it will look like that.
ServerName sub.domain.com
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://sub.domain.org/ [R=302,L]
Last way is redirect via website files. For example you can put index.php (if you're using php) and place in it:
Or proxy it via web-server like `nginx`. upd. as #intense suggested.
ps. I think 302 is the right variant. Not 301 =)
I recently moved my sub-domain hosted Joomla (sub.domain.com) to another host and my SEF URL's are broken. Currently I have Apache mod_rewrite turned off in the Joomla admin forcing the /index.php/ within all URL's
Apache mod_rewrite is loaded and working correctly. The major different in my hosting setup is that before my VPS host had a directory for the sub-domain within the server structure /home/me/sub.domain.com/ now it seems the new host is using another rewrite? as the server files is located in /var/www/domain.com whereas the front-end browser points to http://sub.domain.com
Not sure if there is a custom RewriteBase rule I'm not familiar with to correct this or perhaps there is another rewrite going on within the hosting which I'm not aware of?
Thanks for you time.
Have you made sure, that you DO NOT have set AllowOverride in your vhosts file to "none" ?