I have a magento multisite with 2 tld.
a) domain-a.com (Wordpress files located in /blog)
b) domain-b.com (Wordpress files located in /blog_b)
On domain-a.com i have a Wordpress blog installed on domain-a.com/blog
I want to do that same thing on domain-b.com/blog, but it should show other Wordpress installation located in /blog_b
When i change website address in Wordpress located in /blog_b to /blog, it shows the Wordpress installation in /blog and not /blog_b
I do not want to run Wordpress Multisite, nor do i want to integrate Wordpress and Magento.
I guess i need to make a change in .htaccess so when i visit domain-b.com/blog it shows Wordpress install located in /blog_b?
Hope you understand what i am trying to archieve here.
To keep it simple you could place an index page in /blog, with a frame or something that redirects to /blog_b. But with .htaccess you can do the following:
# Redirect /blog to /blog_b
Redirect 301 /blog http://domain-b.com/blog_b
EDIT:
Right, I did not think about normal requests to domain-a.com/blog. I am not sure, but I think this could work. It will check if the requested domain is domain-b.com, and if the requested subfolder is /blog. If so, forward to /blog_b. Just a suggestion that might not work, I can't test this right now, sorry.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain-b.com
RewriteCond %{REQUEST_URI} ^/blog
Rewriterule ^(.*)$ /blog_b [L]
I solved this by installing a Wordpress multisite instead. I can not say if your answer worked, because i went ahead with other solution first.
Thanks anyway :)
Related
i've a simple question but i cant find and answer for that:
i have in my site-root folder 3 subdirectory, in the first one i have a wordpress site, in the second and in the third two other sites but only for testing like this:
domain.com/wordpress/
domain.com/test1/
domain.com/test2/
Now i want when the user goes on the site to redirect him on my wordpress site but also when i want to access the other sites i directly put the correct address and go.
Right now i have the code down below but, when i try to connect to other folder he redirect me to the 404 wordpress page. How should i edit it to make it works?
I also want if its possible when i go on wordpress to not show the subdirectory in the url but only the domain:
NOT -> domain.com/wordpress/index.php
BUT -> domain.com/index.php
RewriteEngine On #created by aruba do not touch this file!
RewriteCond %{REQUEST_URI} !(.*)wordpress
RewriteRule ^(.*)$ wordpress/$1 [L]
I have my folders in public_html like this,
/ - root public html for example.com [has wordpress in it]
/a/ - this has another wordpress installed and a.example.com should be pointed to this directory
/b/ - again wordpress for b.example.com
I tried this code,
RewriteEngine On
RewriteCond %{HTTP_HOST} ^a\.example\.com$
RewriteCond %{REQUEST_URI} !^/a/
RewriteRule (.*) /a/$1
but it doesn't work. I use VestaCP control panel and don't want to add site for each subdomain instead have it all under the same root directory.
I also noticed that going to a 404 page like example.com/a/somenotfoundpage will show me the 404 page of the root wordpress installation and not /a/ installation
How can it be fixed inside .htaccess ? /a/ and /b/ are both multi site installation each and / is normal installation
the url for the /a/ and /b/ are set to a.example and b.example in wordpress settings
EDIT
VestaCP is set to redirect *.example.com to example.com. (I have used it as an aliases when adding the site, and visiting a.example.com shows me example.com content without the address changing in the address bar)
In your wp-config.php file, there's a line that says Subdomains and it's set to 'false' right now. Change it to true and your site will flip over.
Now that said... You may want to consider .htaccess redirecting the old URLs to the new ones. But it should work just that easily.
I have activated the URL_rewrite in my Joomla 2.5 and have also renamed the .htaccess as was described.
Everything works well. Unfortunately I couldn't find any answer for the following question on the web.
My site can be accessed now through both links:
www.mysite.com/index.php/category
And
www.mysite.com/category
So basically all links that are already available on the web which are including /index.php/ to our site are not forwarded to the site without index.php.
I can imagine that this could cause the problem with duplicate content.
How can I solve this or did I do anything wrong as I would expect from Joomla this would work out of the box?
You could add the folowing .htaccess rule right after RewriteEngine On.
RewriteRule ^index.php/(.*)$ /$1 [L,R=301]
Hope this helps
I've inherited a PHP site from another developer and can't quite figure out what's going wrong. I'm suspecting some kind of rewrite rule somewhere but Im not sure where to look (or what specifically to look for...)
I've installed MAMP and it is working fine. I've got a couple sites running in the MAMP directory with no problems.
When I drop this site in and try to run the pages, I get pages with no CSS, JavaSCript or images. When I 'right-click' an image and open it in a new tab the image can't be found because the browser tries to go up one level in the directory to the MAMP directory in stead of looking in the site root directory.
Same thing on links to other pages, they all try to go up to the MAMP htdocs directory.
For example in htdocs I have the root folder of my site with the index page: 'htdocs/mysite.com/index.php'
On the page is a link to another page <li class="nav_company">Company
Clicking on 'Company' causes the browser to go up to the htdocs folder and look for the '/company/index.php', which of course doesn't exist.
Where do I go looking for the culprit on this? Is there a term or something I can search the site files for? I'm using dreamweaver and cold utilize the find and replace tool if I just knew what to go looking for...
Edit Here's the (sanitized) .htaccess file in the root folder of the site
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sitename\.com
RewriteRule (.*) http://www.sitename.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html$ http://www.sitename.com/$1 [R=301,L]
Redirect 301 /products/ http://www.sitename.com/plastic-handles/
Redirect 301 /plastic/index.html http://www.sitename.com/plastic/plastic.html
Redirect 301 /applicator/index.html http://www.sitename.com/applicator/applicators.html
Redirect 301 /company/index.html http://www.sitename.com/company/about-us.html
Redirect 301 /contact/index.html http://www.sitename.com/contact/contact-us.html
Redirect 301 /news/index.html http://www.sitename.com/news/news.html
Redirect 301 /trade/index.html http://www.sitename.com/trade/tradeshows.html
Thanks in advance.
It would seem that your assets and links are all pointing to the root so /contact/index.php will look at http://localhost/contact/index.php instead of http://localhost/mysite.com/contact/index.php
Look into setting up a virtual host to point to the new sites directory.
Otherwise it would be a case of changing all the links and assets to the full URL e.g. http://localhost/mysite.com/contact/index.php
Hope this helps
Edit: here is a guide to setting up a virtual host http://sawmac.com/mamp/virtual/
Edit 2: in response to your edit, .htaccess isn't going to make a difference as when you click a link or the server looks for an asset it's going to be looking in htdocs/. It will go no further and therefore will not reach your .htaccess.
A site has an existing system (lets call it mysite)
and the client asks to put in magento.
My directory structure goes something like this:
ROOT
-index.php (this is the app's main controller)
-.htaccess
/blog (runs wordpress)
/assets (current system's media folder)
/magento (this is where all magento files go)
Problem is if I set up magento and specify in the installation that base URL is http://example.com, magento loads up mysite.
Leaves me no choice but to setup magento with base URL set to http://example.com/magento/ and it runs perfectly.
However the client wants me to feel hell and asks me to hide magento in the URL.
I’m not really versed in .htaccess and I know only simple rewrite codes so I tried forwarding any HTTP requests that start with /magento to the magento folder and came up with:
RewriteCond %{REQUEST_URI} !^/magento(.*)
RewriteRule (.*) /magento/$1 [L]
Just when I thought it was working, mysite links all became unaccessible and forwards to the magento system displaying it's 404 page.
So, uhm, can I ask for help how to construct the .htaccess to hide the /magento/ on the URLs without affecting the current system aka mysite?
Because you have existing applications off the webroot, you cannot get away with using nothing instead:
### webroot/.htaccess
RewriteRule ^whatiwanttouseinsteadofmagento/(.*)$ magento/$1 [L]
From how I see the problem you will not be able to hide magento completely and use your site as well in the same time.
If you want Magento in the root of the public folder you should just point the virtualHost to your magento installation but this will let your blog and your main controller out of the public view. This is more or less the same with what you did by redirecting all calls in the .htaccess to magento folder.
What I suggest is to change the magento name to something more anonymous like "shopping" or "cart", and remember that a folder rename is preferable to a .htaccess file in terms of security and performance.
Let's look at it:
RewriteCond %{REQUEST_URI} !^/magento(.*)
So we're saying the condition is anything that is not /magento(.*), so everything but that directory? This would redirect everything, including your blog, assets, and any other directories.
Without specifying each and every file that needs to be redirected to the magento directory, there really is no easy way of doing it. I suppose you could redirect any file that does not contain a "/" in it and ends with the extension .php to the magento directory. That way only files in the root web directory will redirect to magento, but if you used other directories inside the magento directory you'd still need to add separate rules for them.
this answer comes very late but I guess you wanted something like
RewriteCond %{REQUEST_URI} !^/(blog|assets|magento)(.*)$
RewriteRule ^(.*)$ /magento$1 [L]