How to run WordPress from other location on the same domain - wordpress

Hi I have a domain running in WordPress,
the path to WordPress installation is /subdomain/mywordpress/ and I can access these in mywordpress.mysite.com, Now I wish to load the index page on my main domain, ie
When I goto mysite.com I want to load the Index page of the WordPress, I know if that possible, the links are always pointing to mywordpress.mysite.com, but that is what I need know. because I dont want to remove the mywordpress.mysite.com. I just need to display all posts on my main site, with same design(that is why I prefer to load the Index file of wordpress)

What about a simple mod_rewrite rule inside a .htaccess to redirect to mywordpress.mysite.com?
This should work:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule . /subdomain/mywordpress/index.php [L]

You should look at this article in the Codex: Giving WordPress Its Own Directory. It addresses exactly the situation you are describing.

Related

Wordpress Install with other software installed in a subdirectory

I'm having an issue that I think can be solved with .htaccess, however, I'm not sure exactly how, htaccess rules have never been a strong point for me.
I have a domain with WHMCS installed on it, in a subdirectory, like this:
/websites/manage/
the /websites/ directory is otherwise empty.
Now, I have installed WordPress on the root of the domain, and I want to use the /websites/ location in the WordPress permalink structure, as I want to build a WordPress page that describes the products and services available there, and use it as a gateway to the WHMCS portal located beneath it.
I've tried searching for an answer to this problem, but I keep turning up tons of results about installing wordpress in a subdirectory, and nothing else.
Thanks for your help.
EDIT:
I should have mentioned:
Currently, I get the WHMCS portal when I go to /websites/manage/, which is fine.
However, my problem is that when I go /websites/ I get a directory listing instead of my WordPress page.
I solved this by adding the following to the beginning .htaccess file, before the WordPress section:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/websites/$
RewriteRule . /index.php
</IfModule>
This redirects the /websites/ directory to the /index.php file which WordPress can then use to find its matching page. It still allows the sub directory /websites/manage/ to be controlled by the WHMCS software residing there.

static to static url rewrite with htaccess with wordpress

I have a wordpress site with its own .htaccess automatically generated (because I'm using permalinks), than, my web-admin has configured apache to redirect any third level domain to my site, ie :
http://lol.example.com redirects to http://example.com
and than .htaccess with permalinks rules does the rest.
Now I want to write a rule in the .htaccess file that, when a user types a specific third level domain, redirects to a specific subfolder of my site, ie:
http://sprock.example.com/ redirects to http://example.com/mysprockfolder/
I know my question might sound weird, but I've never done this before so I'm quite confused.
Solved with that regex in my .htaccess:
Right before this comment (just in case you have WordPress installed):
# BEGIN WordPress
I've added the following:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?thirdlev\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/myfolder/ [R=302,L]
with a 302 redirect, everything is good!
it would be much easier for you to just go to your ftp manager and make a subdomain forward to a link. Or, you can make a redirect using php.
when redirecting make sure to add the http://www. or it will think you want to redirect to a part of your page on the site, also make sure that your subdomain has its own folder with its own files and images.

How to redirect entire wordpress folder with dynamic URLs to a single page

I had old wordpress blog which was under mywebsite.com/wordpress
Now I have moved this blog but I would like to redirect the entire wordpress folder to a single category page mywebsite.com/category/test
The problem is that I don't know how to redirect dynamic pages (all at once) such as
wordpress/?p=1
wordpress/?p=2
wordrpess/?page_id=1362
and others.
I don't need a page to page redirect, just an entire redirect from the wordpress folder to one single category page.
I see that you have used the .htaccess tag, so assume you have access to an .htaccess file.
Try this in .htaccess in the root of your website:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mywebsite\.com$
RewriteRule ^facts/(.*)$ http://mywebsite.com/category/test/ [R=permanent,L]
Let us know if that works!
EDIT: Add a ? to the end of the destination rule to strip the querystring info:
RewriteRule ^facts/(.*)$ http://mywebsite.com/category/test/? [R=permanent,L]
Ben
I'm pretty sure that there's an option under dashboard-->settings-->general (maybe?) that allows you to designate your landing page! and that should redirect your site to that category page....
In .htacess file To redirect the page
Redirect /themes_name/your_file.php /themes_name/your_file.php
First your old blog file path and second new blog file path

Running Wordpress in a subdirectory (not the root)

I have a wordpress site that is currently running in a subdirectory of my website, basically put my structure is as follows:
root/wp
I'd like to keep the wordpress wp folder in the same place however have it load the wordpress site directly from the root url.
For instance currently the site loads when I go to www.mysite.com/wp however I'd like to have the wordpress site load when I simply go to www.mysite.com - currently if I go to www.mysite.com it simply loads an 500 Internal Server Error message.
I would expect I'd need to make some changes to the htaccess files - can anyone suggest how this would be done
So in a nutshell
When I go to www.mysite.com - it looks at the /wp folder but still appears as www.mysite.com in the address bar.
Adding these lines to .htaccess should do the job (not tested, sorry, it may not be sufficient):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ wp [L]
Update: You might wish to check https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory for a way to accomplish this that's closer to WordPress standards.

Have WordPress with a different index file for testing

A site I'm designing a website for was built with static HTML files. I'm converting it to WordPress but I need the old site to still function while WordPress is installed in the same directory (e.g. have index.html be the default one and then have WordPress be something like indexNew.php)
So they go to http://domain.com/indexNew.php to see updates to the new website until it's finished.
How would I configure that in the .htaccess file?
You can use a .htaccess with a simply rule to redirect users to index.html except you :
RewriteEngine on
RewriteCond %{REQUEST_URI} !/index.html$
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteRule $ /index.html [R=302,L]
Replace 123.123.123.123 by your public ip adress.
You should use your .htaccess to set the default document order:
Tired of having yoursite.com/index.html come up when you go to yoursite.com? Want to change it to be yoursite.com/ILikePizzaSteve.html that comes up instead? No problem!
http://www.javascriptkit.com/howto/htaccess6.shtml
In your case, you won't need to rename the index.php at all - this will do the trick:
DirectoryIndex index.html index.php
Anyone who requests yoursite.com will see the content from index.html. To see the new Wordpress content, just navigate to yoursite.com/index.php

Resources