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/
Related
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
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 just pulled a copy from a live site and installed locally using XAMPP. The directory is:
127.0.0.1/website-files/websitename
The homepage pulls up just fine, but no images load. The links do not work either. Image and link URLs have not updated to reflect the new directory. They still show as:
/categoryname/pagename
Instead of
/website-files/websitename/categoryname/pagename
The site is wordpress, and the general settings are updated:
Wordpress Address http://127.0.0.1/website-files/websitename
Site Address http://127.0.0.1/website-files/websitename
I added this to functions.php, which I assumed would do all the changes I needed:
update_option('siteurl','http://127.0.0.1/website-files/websitename');
update_option('home','http://127.0.0.1/website-files/websitename');
.htaccess looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /website-files/websitename/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /website-files/websitename/index.php [L]
</IfModule>
I run into an issue every time I move a website to a new dev server, but this one is a first. What am I missing here?
Avoid using a leading / for any links for your website, so instead of:
foo
<img src="/images/bar.jpg">
Do this:
foo
<img src="images/bar.jpg">
And finally, you might want to experiment with adding a "base href" tag to the top of your HTML, which would have a different value depending on what server you're running on. A quick google for base href will teach you how this works.
You might have to restructure how you build webpages to make this happen. That's simply how things are if you want to be able to run a single website on more than one server.
If you're using Wordpress or another similar open source framework, you might be screwed. Some of them are simply incapable of operating on more than one server.
Try to confirm that home and siteurl have been updated in your local database's wp_options table.
Alternately you can can try setting WP_HOME and WP_SITEURL to point to your local files in wp-config.php. This overrides the settings in the options table.
define('WP_HOME', 'http://127.0.0.1/website-files/websitename');
define('WP_SITEURL', 'http://127.0.0.1/website-files/websitename');
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.
I can't access any pages/login to my WordPress based website.
I get this message:
Forbidden You don't have permission to access / on this server.
after some research on StackOverflow and other WordPress support forums I tried to change the .htacess file without success, also tried to duplicate it from the root directory to /wp-admin again nothing has changed... But I'm not really sure about what I did...
I went back to how it was when it stopped working
permissions are 705 for the folder and 604 for the .htaccess file which is :
SetEnv PHP_VER 5_3
# 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
I'm using WP 3.4 and I don't know if I use PHP 5.3 (what says the .htaccess 1st line) or 4.0.1 (on PHPMyAdmin from the website host access 'OVH')
Thank you very much for your attention.
Ismaƫl
Make WP recreate the .htaccess the file itself.
Delete .htaccess via FTP, then change your permalink structure to default, then back to your desired permalink style. This will recreate the .htaccess. if that fails, you can try to reinstall the WP core by deleting everything except wp-content and wp-config.php.
Found this when looking for a similar issue I had. Cause & fix was different but may be useful to others...
I have some content external to the WordPress implementation, in a directory called "Documents" (outside the WordPress hierarchy). I then wanted a Wordpress page to list those documents so I called the page "Documents". Accessing that page gave an error. The fix was to rename the directory as "docs" (moving it to wp-content may have worked too).
If you are using WP All-in-One Security plugin, be sure to check the .htaccess file in the root of your Wordpress installation, and look for a section on whitelisted IP addresses. If your current IP is not in the list, then you will get the 403 error.