Nginx - Show content with out redirect - nginx

I have this domain:
test.com/test/test.mp3
And I have also
othertest.com
What do I need to do in the vhost to show the first URL's content in the second domain? I need to have the following:
othertest.com/test/test.mp3
Is there a way to do it?
Thanks

Related

park a domain without redirecting in wordpress

i have a wordpress website with this name mydomain.ir
i parked mydomain.com to this website. but when i type mydomain.com it redirect to mydomain.ir
i want to address stay on mydomain.com .
i try some plugins but didnt work properly.
my host service told that this is a worpress error and you should change your codes.
i tried this but didnt work too
what can i do to do this?
thanks for your answers
First of all, make sure that you have the correct url at wordpress settings. Check Settings->General and make sure that site and home urls ar the one you want.
Next, check if there is any kind of redirection at .htaccess file.
Then, check at your cpanel if you have added any redirection there.
Finally, make a search at your wordpress database for your unwanted domain name. Make sure to change all old urls to the new one. Try this plugin for that: https://wordpress.org/plugins/velvet-blues-update-urls/
Update:
Alternatively, you may want to mask your domain. This should be done through your domain name registrar.

WordPress : Why url header alway redirect?

I use wordpress.When i upload to server it alway redirect to www.ex.com/www.ex.com/wordpress.
The right url is www.ex.com/wordpress.
But in my localhost it is OK. it can be with localhost/wordpress.
And it can go to url www.ex.com/wordpress/wp-admin. But it can not go to www.ex.com/wordpress.
Thank you.
Add below two lines on top of your theme's function.php
update_option('siteurl','http://www.ex.com/wordpress');
update_option('home','http://www.ex.com/wordpress');
Go to Settings>General and make sure your wordpress urls are correct. Also make sure you do not have any redirect Plugins. Also if you have any custom code of you then the wordpress won't change the urls from localhost to the correct urls, you need to do it manually. Furthermore, make sure your urls are like http://www.yourlink.com and not like yourlink.com

lots of redirect chains WordPress site on ngix + php fpm

until I added the string: remove_filter('template_redirect', 'redirect_canonical'); to functions.php of current theme the site even did not load in browser. Now it loads ok, but when I checked site load with tools.pingdom I saw dozens of those "Remove the following redirect chain if possible" errors. Each of them is the same error about some image:
Remove the following redirect chain if possible:
http://www.domain.com/wp-content/thumbs/fgd/0-9/10-bullets.png
http://domain.com/wp-content/thumbs/fgd/0-9/10-bullets.png
etc. about 200 of the same kind.
It is a game arcade plugin and those are paths to thumbnails of games. Could you point me where to dig?
Ok, it seems that you have (or used to have) your wordpress site configured at the url www.domain.com
This means that any images you pasted on your posts began with www.domain.com.
It's possible that images on your theme are also hard linked to www.domain.com too.
Your nginx vhost has these rules
server_name www.domain.com domain.com;
if ($host != 'domain.com') {
rewrite ^/(.*) http://domain.com/$1 permanent;
}
Which mean "listen to either www.domain.com or domain.com, but force whoever request the www domain to perform another request in order to end up at domain.com."
This is meant to canonicalize your site url and avoid google indexing your content twice, which would split pagerank and authority and probably downrate it as duplicate content.
The problem is that this rule operates on the images you already have linked ar www.domain.com, so everytime you request them, nginx redirects you.
TL/DR
Make sure the url you have configured at your wordpress installation matches the one you're enforcing in your nginx vhost. If you want to strip the www part, fine, but do it in both parts.
Second: for the images on your theme, you'll have to manually edit the urls to get rid of the www. You can also use relative links
<img src="/wp-content/thumbs/fgd/0-9/10-bullets.png">
instead of
<img src="http://domain.com/wp-content/thumbs/fgd/0-9/10-bullets.png">
Third: do the same check for the posts you have published until now.

ISAPI_rewrite multiple domains and rewrite urls

For .htaccess file, with ISAPI_rewrite
I'm designer not coder, need help if someone can code for rewrite urls for SEO - Thanks in advance.
I have multiple domains on same server and each domain's content is sharing folders:
(www.)domain1.com/
(www.)domain2.com/
all should rewrite and url show http(s)://www.maindomain1.com
and content is from root/sitefolder1/index.php
and same for other pages like:
(www.)domain1.com/about.php
(www.)domain2.com/about.php
should rewrite and url show http(s)://www.maindomain1.com/about.php
and content is from root/sitefolder1/about.php
but contact page need to rewrite like:
(www.)domain1.com/contact/person-name1
(www.)domain2.com/contact/person-name1
should rewrite and url show http(s)://www.maindomain1.com/contact/person-name1
and content is from root/sitefolder1/contact.php?p=person-name1
and for blog I am using wordpress so need rewrite for that too,
I am using permalinks option "Post name http://www.example.com/sample-post/"
(www.)domain1.com/blog
(www.)domain2.com/blog
should rewrite and url show http(s)://www.maindomain1.com/blog
and content from root/sitefolder1/blog/ (not sure, what page wordpress use)
(www.)domain1.com/blog/post1
(www.)domain2.com/blog/post1
should rewrite and url show http(s)://www.maindomain1.com/blog/post1
and content from root/sitefolder1/blog/ (not sure, what page wordpress use)
(www.)domain1.com/blog/category/post2
(www.)domain2.com/blog/category/post2
should rewrite and url show http(s)://www.maindomain1.com/blog/category/post2
and content from root/sitefolder1/blog/ (not sure, what page or folder wordpress use)
and same process for other domains as domain1 and doamin2 like:
(www.)domain3.com
(www.)domain4.com
all should rewrite and url show http(s)://www.maindomain2.com
and content from root/sitefolder2/index.php
The starting point for you can be helicontech.com. Start with FAQ - http://www.helicontech.com/forum/10648-FAQ.html, move to Examples Section - http://www.helicontech.com/isapi_rewrite/doc/examples.htm. There you'll find the first couple rules to redirect domains. In order to use WP - read http://www.helicontech.com/articles/isapi-rewrite-with-wordpress/

Wordpress 3.0: Menu Question

HOw can you make a custom menu that goes to the home page but the url is not static? Like I am in a test server right now, so the url is localhost/mywordpress. I put a '/' in the url for my custom menu but it redirects to localhost.
Is there a way to put it in a way it can goes to the homepage of my test server?
Thanks
Just use /wordpress/ and remember to change it back on the production server.
Better yet, use Apache VirtualHosts to map a fake domain to a document root. Check out my answer on setting up a VirtualHost.

Resources