Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 8th Oct 2015, 07:01 AM   #1
Warrior Member
 
Join Date: 2014
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Default
htaccess - 301 redirection and WP SEO URLs don't work
Share on: 
fb share twitter share gplus share more share

I've already searched thoroughly for tutorials on how to configure .htaccess but I just can't get it work properly no matter what I try. Hopefully you will be able to help me out, let me explain the current situation. There are already several 301 and other redirections in htaccess files, so let me simplify it and if it still won't work, I'll post full .htaccess files for a more detailed description.

Folder of old HTML website: public_html/old
Folder of new Wordpress based website (Site Address is set to www.domain.com): public_html/new

As of now, new Wordpress website works fine if one opens www.domain.com or www.domain.com/new. However, the old website is still accessible via www.domain.com/old, so I would like to redirect it to the new website. To put it in other words, I would like to permanently redirect absolutely everything from www.domain.com/old as well as subfolders to the new website.

Could anyone please write me down which rules should I use in .htaccess and in which folder should I put it?



The second problem is about new Wordpress website. Everything works fine except when I try to use SEO URL's in http://domain.com/sample-post/ format. In that case www.domain.com will open fine, however I get the followiong 404 error for all subpages (e.g. www.domain.com/news etc.)

"Not Found
The requested URL /index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

Here's .htaccess from WP folder (public_html/new):
Code:
RewriteEngine On
DirectoryIndex index.php
RewriteBase /new
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /new/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /new/index.php [L]
</IfModule>

# END WordPress
Thanks a lot for help!
krneki10 is offline  
Unread 17th Oct 2015, 10:36 AM   #2
Banned
War Room Member
 
Join Date: 2010
Location: ǝɹnʇnɟ ǝɥʇ
Posts: 1,639
Thanks: 1,641
Thanked 706 Times in 364 Posts
Default
Re: htaccess - 301 redirection and WP SEO URLs don't work
Share on: 
fb share twitter share gplus share more share

remove this file, but save it.. then go into WP and re-save permalinks to generate a new and correct W HTACCESS file. then add any further htaccess code to it.
jasonthewebmaster is offline  
Closed Thread


Bookmarks

Tags
301, htaccess, redirection, seo, urls, work


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 11:44 PM.