Apache mod_rewrite help with Wordpress - apache

I administer my wife's site, namelymarly.com. Up until last week, the root page of the blog was namelymarly.com/blog/.
Last week I changed it in the WP settings to be namelymarly.com.
WP created the new htaccess file, and I moved the index.php to the root directory (but left the WP folder where it was in the /blog/ directory), as instructed. Everything is working great except for one very important thing:
When you type 'namelymarly.com/blog/' into a browser now, you get a 404 error.
All other URLs, when they include the '/blog/somethinghere', will redirect properly to '/somethinghere.' It's only when there's nothing after '/blog/' that there's a problem.
I tried adding this rule but it still redirects to the 404 page:
RewriteRule ^/blog/$ /index.php
Any suggestions/help?

install "Redirection" and then add a 301 redirect from namelymarly.com/blog/ to namelymarly.com

Did you follow these diections?: Moving WordPress « WordPress Codex
You don't need the redirection plugin. Wordpress handles redirects if you regenerate permaliks. If you have to, use this in .htaccess before the Wordpress rewrite block:
Redirect 301 /blog http://namelymarly.com
But first, be sure you've reset your permalinks in Dashboard/Settings/Permalinks and make sure that copy the changes to .htaccess yourself and that there is only the most recent - the last - rewrite block in the file (WP has a habit of adding more and more rewrite blocks to .htaccess).
And check the URLs of your other URLs in the post/page editor and see if they contain /blog/

Related

htaccess redirecting website.com/folder/content to subdomain.website.com/content

I recently moved a Wordpress blog from website.com/wordpress to help.website.com. Now I want to redirect the links to the old adress to the new adress.
I deleted everything from the /wordpress folder except the .htaccess. This file has the following code:
RedirectMatch 301 (.*) http://www.help.website.com$1
It redirects my old links but I don't know how to remove the /wordpress from them.
For example if I access website.com/wordpress/article-categories/example-article/ it sends me to help.website.com/wordpress/article-categories/example-article/, but I want to get to help.website.com/article-categories/example-article/ instead. How do I achieve this?
Try
RedirectMatch 301 ^/wordpress/(.*)$ http://www.help.website.com/$1
This will match the folder literally without capturing it.

Joomla | enabling SEF removes index.php, but returns a 404 page. Page visible thru index.php/page. How to fix?

I'm running Joomla 2.5.8 and I'm trying to delete the stupid index.php so having SEO friendly URLs. Yet.. When enabled and rebuild' the menu, when I click on a menu item the site goes to the page without the /index.php/ BUT it returns a 404 page. However, when I manually type /index.php/ between the domain and the page, I see the normal page.
A few notes
I changed htaccess.txt to .htaccess
I removed the '#' before RewriteBase /
I added 'cms' to the directory path (RewriteBase /cms ) Since Joomla is in the /cms folder
However, the htaccess is in the SAME folder as Joomla itself, they both lie in a subfolder
In the root folder, where a different website is stored, there also lies a .htaccess file
Any suggestions guys?
Thanks!
Sounds like your config is OK.
The htaccess with RewriteBase /CMS, should be in the /CMS folder.
In Joomla you should have sef rules enabled and use mod_rewrite option enabled.
This could simply be a cache clearing issue.

Apache redirecting in CakePHP: old pages ending with .php to new ones

I have a new CakePHP site, and I wish to redirect some old urls to new ones.
/contact.php to /contact
/news.php to /
/courses.php to /courses
I've tried 301 apache redirect inside the .htaccess (the root one, inside /app and inside /app/webroot, but none worked.
I also wanted to redirect all non www urls to www. I looked this thread but the example didn't worked for me. I'm using CakePHP 2.0.
Can somebody help me?
If your CakePHP is installed into root you should be able to redirect these URLs into correct ones with routes.php. Take a look into redirect routing documentation: http://book.cakephp.org/2.0/en/development/routing.html#redirect-routing
is important that your server have mod_rewrite enabled.
You can then modify the url in app/config/routes.php
Although still not clear to me as you had before contact.php type routes

Error is .htaccess - Redirects not working and its very strange

My site has just recently launched a bunch of new product pages, replacing the old ones.
Here is an example of a redirect I want. One going from the old page...redirecting to the new page. I checked Google webmaster and said that there was a not found error for the second link.
Redirect 301 /it-infrastructure.html http://www.example.com/managed-enterprise-services.html
Redirect 301 /it-infrastructure http://www.example.com/managed-enterprise-services.html
So the .html one is redirecting fine...but the one without the .html extension is not. BUT...what's strange is that I have a bunch of redirects from the past that don't use the html ext and work fine, such as:
Redirect 301 /broadsoft-web-portal http://www.example.com/broadsoft-web-portal.html
and
Redirect 301 /business-voip http://www.example.com/business-voip.html
Anyone have any idea why this isn't working?
Add to your .htaccess this line
Options -MultiViews

Redirect entire site except one directory to a new site - apache .htaccess

I am trying to move my current site over to a new domain, except for ONE directory.
Example:
current site: oldsite.olddomain.example
new site: newdomain.example
So I know I can create an .htaccess redirect entry to do this, and it works, but I want ONE exception - I do NOT want to redirect a specific directory. I still want this to work:
http://oldsite.olddmain.example/myspecialdirectory/… and every file and directory under it.
Can someone help?
Thanks!
Try this mod_rewrite rule in the .htaccess file in the document root of oldsite.olddomain.example:
RewriteEngine on
RewriteRule !^myspecialdirectory($|/) http://newdomain.example%{REQUEST_URI} [L,R=301]