I have a website (http://alvarezpatrick.com) that uses wordpress. I have set up a subdomain (portfolio.alvarezpatrick.com) which I want to use to show example projects, etc. and which I would like not to be part of wordpress. However, if you go to http://portfolio.alvarezpatrick.com it seems to redirect you to http://alvarezpatrick.com, and if you go to http://alvarezpatrick.com/portfolio_html/index.php it seems to say it isn't found.
From looking around I've seen that it should work if I do the following, but unfortunately it does not:
Edit the .htaccess in the main public folder by adding:
RewriteCond %{http_host} ^(www\.)?alvarezpatrick\.com$ [nc]
Create a .htaccess in the portfolio.alvarezpatrick.com domain root folder "portfolio_html" with the following single line of code: RewriteEngine Off
Your main website is on public_html. To avoid using the wordpress on your sub-domain you can point the sub-domain outside the public_html.
For example:
/portfolio/ --- portfolio.example.com
/public_html/ --- example.com
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 a wordpress install which has only two custom post types ( blog and howto ).
The blog is located in a directory inside root folder where also are few html pages, like this :
To access a certain custom post type from html files i have an href to wp/blog and another one to wp/howto.
The problem is that i want to jump that wp so my url will be like localhost/blog instead localhost/wp/blog.
I tried with
RewriteEngine On
RewriteRule blog/ /wp/blog/
RewriteRule howto/ /wp/howto/
in .htaccess from root directory, it shows me the blog template, but only 404 page error and i have no idea what should i modify to get the wordpress posts.
PS : Sorry for my english and for my blurry message, deadline's coming and i have no idea what should i do to skip that folder.
1) in your dashboard, go to settings -> general and make sure
a) wordpress directory -> http://mydomain.com/wp
b) site address -> http://mydomain.com
2) move your index.php from subdirectory to the root (MOVE, don't just copy)
3) edit your index.php to read
/** Loads the WordPress Environment and Template */
require('./wp/wp-blog-header.php');
where "wp" is your subdirectory
4) delete any .htaccess file in the subdirectory
5) add this to your .htaccess in the root
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Under this setup, your wordpress installation will be located in /wp/ directory. Visitors will visit your site using http://mydomain.com.
If you want to have a good read-up on everything so you know exactly what you're doing, read this https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
If i understand you correctly - all the wordpress system files are inside the "wp" folder.
if that is the case all you need to do is to drag them out to the main folder and the problem would be fixed by itself.
As far as the post types (blog/howto) if those are post types inside the wordpress system the are not effected by real folders but by something call Wildcard DNS - which is a method of linking url's to content by values inside the url. this means that the folder does not have to exist inside the server but just in the system.
For solving your issue i recommend to just, as i said before - drag all the files from inside the folder "wp" - outside of it.
And after that you will need to log in to the database with phpmyadminor any other client you have and go to:
A) choose wp_options
B) Look option_name for siteurl and remove the "wp" from the url. (if it's http://sample.com/wp change it to http://sample.com)
C) Look option_name for home and do the same.
Edit:
Try this:
in your root directory (the parent of "wp"), open the .htaccess file and add inside mod_rewrite.c:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$
RewriteRule ^(/)?$ wp [L]
change the YourDomain.com to your real domain.
this should work :)
source: ~here~
im looking for a solution just like this. People keep on going around the question. What you want is for the custom posts to look like they come from the route mysite.com/todo/have-a-nice-day mysite.com/blog/todo/instead of mysite.com/blog/
I am unable to access my WordPress site URL, it redirects like
http://www.mydomain.net/wp-login.php?redirect_to=http%3A%2F%2Fmydomain.net%2Fmydomain.net%2Fwp-admin%2F&reauth=1
but it shoud redirect to
http://www.mydomain.net/wp-login.php?redirect_to=http%3A%2F%2Fmydomain.net%2Fwp-admin%2F&reauth=1
I believe the problem is with .htaccess file as I am rewriting the path of folder like
public_html/mydomain.net
instead of public_html as this domain is primary domain of cPanel but to avoid confusing, I created a directory and rewriting path using .htaccess.
There is nothing wrong with WordPress. In settings>general both the URLs set to mydomain.net
.htaccess code is Placed in Public_HTML
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.net$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.net$
RewriteCond %{REQUEST_URI} !mydomain.net/
RewriteRule (.*) /mydomain.net/$1 [L]
I had a similar problem after changing the root directory of my blog (before migration) and trying to coming back... Changing the data in my DB was not working for me.
I still did not figure out why but I had a "page not found" when I tried to access categories, tags,... and even on the home page. Links to articles worked correcly and the administration page was not accessible (wp-admin rewritten twice in the url).
These actions solved my problem:
Edit the wp-config.php file.
After the "define" statements (just before the comment line that says "That's all, stop editing!"), insert a new line, and type:
define('RELOCATE',true);
Save your wp-config.php file.
Open a web browser and manually point it to wp-login.php on the new server.
I had to change the value of the root directory in the administration page (after these actions gave me back the access to it).
Check http://codex.wordpress.org/Changing_The_Site_URL#Relocate_method for more info.
Alright I have already contacted BlueHost Support and they couldn't figure out how to fix this issue. I've also tried to use cpanels 301 permanent redirect but that doesn't work so I decided to give it a whirl on here.
I host with BlueHost.com if you haven't caught that by now. The file structure is as follows:
public_html/
directory1/subdomaindirectory
directory2
directory3
I have my main website in my root (public_html). Then I have to create new directories and assign the url to that directory. So essentially if you typed in www.maindomain.com/directory1 it would show the website in the directory. I would like to modify the .htaccess to redirect that to it's original domain so www.maindomain.com/directory1 would go to www.directory1.com
The same for subdomains. I created subdomain.directory1.com and pointed it to public_html/directory1/subdomaindirectory and if you go to www.directory1.com/subdomain it pulls up the site.
I realize theoretically it's the same thing but it bugs me that you are able to pull up a website like that.
Is there anyway to modify the .htaccess to fix this issue?
In.htaccess you could do it like this
RewriteEngine On
RewriteBase /gorbox
RewriteCond %{HTTP_HOST} ^www.gorbox.com$ [NC]
RewriteRule ^support$ http://support.gorbox.com [L,R=301]
Put this in the .htaccess file that resides within the root folder of www.gorbox.com