Nginx Rewrite For Magento/Fishpig integration - wordpress

I have Magento and Wordpress running together via Fishpig integration. Which is fine.
Fishpig requires to use a prefix in your URL to identify it's WP related (e.g. http:/domain.com/blog/your-page-url).
What I need is a Nginx rewrite for URLs which won't have the blog bit.
If I user types
http:/domain.com/your-page-url or
http:/domain.com/another-page-url?somevar=1
I want to keep the URL like that but internally Nginx would deliver
http:/domain.com/blog/your-page-url
http:/domain.com/blog/another-page-url?somevar=1
Any help would be really appreciated.

Related

Trying to rewrite URLs for wordpress / nginx / WPML install

I have some wordpress experience, but it's my first time using Nginx. I have a WordPress installation running on Nginx. I added WPML (multi-language plugin) https://wpml.org/
The current URL structure is https://www.maindomain.com/blog/es/.... & https://www.maindomain.com/blog/en/.... etc. Everything works fine.
I'm looking for a way to rewrite the URLs in ninginx conf for the whole set-up to work with: https://www.maindomain/es/blog/.... instead of https://www.maindomain.com/blog/es/ and so on.
I tried several things and eventually i got stuck on:
rewrite ^/blog/en/(\w+\.?.*)$ /en/blog/$1 last;
which gives a 404 error on both URLs.
Any ideas on how to do this? Or is there a better way of doing this other than with rewrites?
...is there a better way of doing this
Possibly, yes. You can install WordPress in a root directory instead of a subdirectory (/blog) or point the domain to the subdirectory. This will give you URLs like maindomain.com
You can then set the Language URL setting in WPML to "Different languages in directories". This will give you URLs like maindomain.com/es/. Finally, you can create a page with the blog slug in WordPress (you should be able to set the same slug for the translation) and it will be accessible at maindomain.com/blog or maindomain.com/es/blog.

Rewrite Magento url to Wordpress page

I have a Magento site installed at the root of my domain and a Wordpress installed in a subdirectory. Currently I access my sites like this:
Magento: "domain.com"
Wordpress: "domain.com/blog"
I would like to be able to use Wordpress Pages seamlessly, without the "/blog" subdirectory showing in the url, such as:
Wordpress Page-X: "domain.com/page-x"
Note that I do want to keep the "/blog" subdirectory showing normally for blog posts etc... I just don't want it for Wordpress Pages.
Could anybody help on how to set that up? I was think tweaking the .htaccess would've work, but I can't find out how. Other solutions are welcome too. Thank you.
Magento provides you with an option to create custom URL rewrites in the backend (admin) you can find it here. This way you should be able to create rewrites. Also if you want to automate the creation of rewrites you can refer to the core_rewrites table in magento's database. Also this is a good read if you want to do logic based rewrites on the fly.

ASP.NET Url Rewrite Subdomain Wordpress II7 Web.Config

I have a server that host a variety of asp.net sites on a IIS7 server.
A few of those sites have wordpress blogs in a folder called blog (which is obviously written in PHP). Due to security issues, we need to move those wordpress blogs to a linux server.
So instead of http://www.domainname.com/blog we now have http://blog.domainname.com/ which has the blog url.
The only problem is, due to SEO reasons, we need the blog to be on the same domain as the main site (which is written in ASP.NET).
My question is, is there a way to do a url rewrite so that if someone types in a wordpress link, similar to this:
http://www.domainname.com/blog/index.php/archives/category/mycategory
Can I use a web config URL rewrite to have the above typed in URL actually point to
http://blog.domainname.com/index.php/archives/category/banking
I can't do any sort of redirect. It has to be a rewrite, I've tried righting one myself but have been unable to. The subdomain is the part of the rewrite I can't get past.
Has anyone tried to do this before?
Is there some better way I go about this if not.
Keep in mind the blog and the asp.net site cannot be on the same server due to security reasons, but they must keep the same domain name.
You can't just do a rewrite as the URL you want to rewrite to is on another domain / website. Rewrites only work on the same website.
You have to setup IIS as a reverse proxy server with the ARR module. In combination with the URL rewrite module you will be able to invisibly forward all requests for http://www.domainname.com/blog/* to http://blog.domainname.com/*.
Also note that you will have to setup outbound rewriting in order to change back the URL's that are generated by Wordpress (from http://blog.domainname.com/* back to http://www.domainname.com/blog/*).
See for an example this tutorial: Reverse Proxy with URL Rewrite v2 and Application Request Routing.

Migrate/map Wordpress.com blog to subdomain on a TYPO3 powered domain

I have a blog test.wordpress.com
I have a website powered by TYPO3 www.mysite.com
I want to redirect(map) my wordpress blog to www.blog.mysite.com
I want mysite.com to remain unchanged and my blog to be powered by wordpress.com
Is there anything I need to do within TYPO3 for the migration to work? Do I need to create a subdomain in TYPO3 manually?
Is following the wordpress advice - changing the c name suffice?
No, you do not need to map it via TYPO3.
It's better idea to use some redirect with your HTTP server (probably Apache) - most probably within some admin panel or .htaccess file.
That all I can advice now. Ask the administrator of your hosting for support with domain redirections. If it won't be possible you can do it in TYPO3 but it does not make a sense.

Reverse proxy heroku app to wordpress blog

I've managed to setup a reverse proxy of my heroku app with the following in config.ru
require ::File.expand_path('../config/environment', __FILE__)
use Rack::ReverseProxy do
reverse_proxy /^\/blog(.*)$/, 'http://blog.domain.com$1', opts={:preserve_host => true}
end
run Appname::Application
This allows my heroku app to run at domain.com and have domain.com/blog appear as the URL while the wordpress site is being served blog.domain.com. Great so far.
The wordpress site gets served properly when going to domain.com/blog, however when I go to any deeper page like an individual post wordpress throws an error. I was using permalinks with the date and title in the URL of the form: domian.com/blog/2012/07/a-great-blog-post - Worpress now seems to not like this. When I switched the links back to the form domain.com/blog/?p=4 the page gets served successfully.
It seems like it doesn't handle and sort of trailing slashes after the inial domain.com/blog properly. What I find strange is domain.com/blog/wp-admin (and the entire WP admin app) works without any hiccups.
Can anyone see any glaring issues why the pages/post with multiple slashes '/' might be causing problems?
Thanks in advance!
Well I found a solution, for whatever reason in the WP settings for the permalink, it didn't like any of the default options except for the form where it can retrieve the post by id. (http://www.domain.com/blog/?p=123)
For SEO purposes I wanted the title of the post to be in the URL. So I entered in the custom structure field:
/index.php/%postname%/
It seems like it was requiring index.php for wordpress to handle the routing properly.

Resources