Forum Moderators: phranque
I can do that by 301 redirect in .htaccess file, but the old permalinks (www.domain.com/permalink/post-title) get messed up.
How can I make exceptions for those old permalinks. I want the old posts to still be readable and findable (on the old page).
Here is my .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(novice)/
(zabava¦glasba¦filmi¦serije¦umetnost¦dogodki¦blodnje¦tehnologija¦druzba¦video¦igre¦politika¦narava¦fotografija¦internet)/([0-9]*)/ index.php?modul=$1&kategorija=$2&stran=$3
RewriteRule ^(novice)/
(zabava¦glasba¦filmi¦serije¦umetnost¦dogodki¦blodnje¦tehnologija¦druzba¦video¦igre¦politika¦narava¦fotografija¦internet)/ index.php?modul=$1&kategorija=$2
RewriteRule ^(novice)/([0-9]*)/ index.php?modul=$1&stran=$2
RewriteRule ^(novice)/ index.php?modul=$1
RewriteRule ^(arhiv)/([0-9]*)/([0-9]*)/ index.php?modul=$1leto=$2&mesec=$3
RewriteRule ^(arhiv)/ index.php?modul=$1
RewriteRule ^(permalink)/([0-9]*)/(.*)/ index.php?modul=$1newsid=$2&naslov=$3
RewriteRule ^(predlagaj)/(poslji)/ index.php?modul=$1poslji=$2
RewriteRule ^(predlagaj).html index.php?modul=$1
ErrorDocument 404 /index.php?modul=404
What do you recommend I should do?
Thank you so much for your help.
Also, note that from your description, you installed WP in a subdirectory, not a subdomain.
Jim
If I use
Redirect 301 / [domain.com...]
I get an infinte loop.
So I use
Redirect 301 /index.php [domain.com...]
And that seems to work, but it messes my old permalinks.
For instance:
[domain.com...]
becomes:
[domain.com...]
I have also tried with this
RewriteRule (.*) [domain.com...] [R=301,L]
But the result is the same.
As an example of potential problems, if your Redirect executes after your internal rewrite(s), then the internally-rewritten script filepaths will be exposed to the client (browser or search engine robot). Also, if you change servers (or get "upgraded" by your host) the relative order of processing of mod_alias and mod_rewrite may change, breaking your site.
As such, if you use mod_rewrite for any rewrites or redirects, it's a good idea to use it for all rewrites and redirects.
The most likely problem you're seeing is that either DirectoryIndex or the code installed by WP in /blog/.htaccess is interfering with your desired redirect. A likely solution is posted in this recent thread [webmasterworld.com].
You will probably want your RewriteRule and RewriteCond to handle requests both for "/" and for "index.php". To do that, the form of the subpattern will be "(index\.php)?" so that it matches either "index.php" or blank.
Note that all RewriteRules should end with an [L] flag, unless you know the reason that you don't want to use it in a particular case.
Jim