Make WordPress' default posts go to /blog -- permalinks not working - wordpress

Consider the following post types
Posts (default in WordPress)
Accessories (Custom post type)
I want posts to go to /blog. Accessories slug has been defined as /accessories.
To achieve this, in settings > permalinks > and have defined my custom structure as /blog/%postname%/.
With this, when I go to /blog/, I get a 404. However, when I create a post in posts, the permalink shows up as /blog/test-title.
Also, with the custom structure set, when I try and go to /accessories, it also 404's.
Questions:
Why does /blog 404? It should use index.php as it's template, no?
Why does /accessories 404 with this change?
How do I get /blog and /accessories working?

To get this WordPress permalink stuff to work correctly, the underlying apache web server grabs the incoming URL requests and rewrites them underneath the covers so they point to /index.php?something=something. For this to work, apache must
have an extension module called mod_rewrite enabled,
be configured to allow rewriting in your WordPress instance, and
be able to write a file called .htaccess in the same folder as your WordPress index.php.
You didn't mention what kind of OS your server lives on, so it's difficult to give you specific advice. You might check Digital Ocean's fabulous documentation for help.

Related

Redirect Wordpress posts to a new post title

I have a Wordpress blog in which I want to rewrite the post titles. The problem is that the permalinks will change, since they're based on the title, and inbound backlinks that reference the url that was created from the original title won't work.
What I need to do is rewrite the titles, but then create pages with the original permalink urls that redirect the reader to the new title, so that backlinks keep working.
Any ideas how to do this?
The best way I can think to do it is to add rules to your .htaccess or vhost file for Apache (or whatever http server you are using).
You can find many examples on the web using mod_rewrite.
Redirecting and Remapping with mod_rewrite
Doing a quick Google search on "wordpress permalink redirect" also turns up many result so how to handle this type of issue.

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.

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.

WordPress with Yahoo! Hosting... Almost there

EDIT:
Yeah, so this problem is really unsolvable. Yahoo prevents access to .htaccess, even from WordPress itself trying to change it. I had to settle for writing a script on the default homepage that redirects browsers to "www.abc.com/index.php" if they go straight to "www.abc.com". You always have to deal with "index.php" being in the address bar but it's better than not having permalinks...
/EDIT
Yahoo! Small Business hosting seems specifically engineered to make WordPress difficult-- but it's my client's host and there's not much I can do about it. I'm trying to move WordPress into the root directory, and I'm sooo close to having it done.
I've read and read and read about how to get the Permalinks to work right, and since Yahoo! hosting doesn't let you modify htaccess I am pretty much up s*** creek. I'm using the simple permalink structure of "/%postname%/", which once I moved to the root, stopped working. I have changed it to "/index.php/%postname%/", which allows you to see the pages if you manually type in index.php before the page name or if you are logged into the admin area and "View Page". Also, the correct permalink shows on all of the pages in the editor.
However, WordPress doesn't let you change the permalink of the static page you use as the front page.
Long story short, if I go to "www.abc.com/index.php", the links in the menu all work fine. However, if I just got to "www.abc.com", the links don't pick up the "index.php" from the permalink structure. I need to fix this, so if anyone knows how to either:
Change the permalink of the static front page
Fix something in the database if I install PhpMyAdmin
Work around not having access to .htaccess
Put a small script somewhere on the index page to append "index.php" to the url
Any other suggestions
It seems it would work if I was NOT using a static front page but rather the blog, but this isn't an option. I've tried changing the "Tag base" setting to no avail, as well as deactivating the Yahoo! Custom Permalinks plugin (and reactivating it again after that failed...). Could really use some help!
Check out Giving Wordpress its own directory. I can see how this could solve your problem. Also make sure that you have done the obvious, and change your url for WordPress address (URL) Site address (URL) inside the general settings page. Perhaps the static homepage should be developed outside of wordpress, and then you can follow the steps provided in the link I provided. Hope this solves your issue.
Yahoo doesn't allow users access to the htaccess file which means that you can't the mod_rewrite rules needed for custom permlinks. The Only way around it that i've heard it works (never tried it myself) is to add /index.php/ to the beginning of your custom structure so: Go to Permalink Settings > Select Custom Structure. And set the value as /index.php/%postname%/ or what ever you want as long as you add /index.php/ before it.
Hope this helps.
I had a similar problem with this host (in 2018! 4 years after your question) that I finally solved by changing the permalink settings.
Settings > Permalink Settings > Custom Structure: /index.php/%postname%/
I wish there was a better solution but Yahoo Small Business still doesn't allow .htaccess files - after several frustrating rounds with customer service, I finally admitted defeat and used this work around.

Wordpress, why doesn't my blog load the posts if U use the /subfolder domain method?

I have a blog at http://hamids-it.elaosta.com amongst others. If I try to access it from
http://elaosta.com/hamids-it it loads the blog but says it couldn't find the page I wanted.
How do I fix this so I can use either?
I'm guessing you have a standard subdomain install, whereby http://subdomain.example.com is mapped to the directory /example.com/public_html/subdomain?
In any normal circumstance, say with a static HTML file, you can rightly access the same resource at both example.com/subdomain/resource.html and subdomain.example.com/resource.html.
However, in your case, WordPress is parsing the REQUEST_URI and using it to determine what to show.
So in the case of http://elaosta.com/hamids-it, WordPress is actually looking for a page 'hamids-it' - and if it doesn't find it, voila, your 404.
The fix?
You'll need to decide which way you want to access your blog, subdomain or sub-directory, then stick to it.
When you've made a choice, update your General settings in WordPress admin and set both address URL's to either http://hamids-it.elaosta.com or http://elaosta.com/hamids-it.

Resources