Mobile app version of vmapp.org
Login or Join
Steve110

: How to redirect an old url to a new url via htaccess? Website uses Wordpress Possible Duplicate: .htaccess Redirect Old Threads We had quite a hefty news site which had very ugly

@Steve110

Posted in: #Redirects #Url #Wordpress

Possible Duplicate:
.htaccess Redirect Old Threads




We had quite a hefty news site which had very ugly urls from a custom cms. We have since relaunched and moved all the content over to Wordpress and have used "pretty permalinks".

We were also running a newsletter campaign throughout and would like to redirect all the ugly url's to the pretty one's. How can this be done? Can they be put in the htaccess file? We just want it so when the url is clicked in the newsletter it will redirect to the new url.

Here is an example of what we want:

We want this - www.domain.com/index.php?id=3&nid=91 to be redirected to this mediwales.com/this-is-my-pretty-permalink
What type of redirect's should they be?

UPDATE:

This is my current htaccess file in the root:

RewriteEngine on
RewriteRule ^([0-9A-Za-z]+)$ /index.php?page= [L]
# 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

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Steve110

2 Comments

Sorted by latest first Latest Oldest Best

 

@Lengel546

U can use this .htaccess

RewriteEngine on
RewriteRule ^([0-9A-Za-z]+)$ /index.php?page= [L]
# 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
Redirect /index.php?id=3&nid=91 mediwales.com/this-is-my-pretty-permalink

Problem is u have to add every redirect manually (See below)
The .htaccess is the same as yours, except the

Redirect /index.php?id=3&nid=91 mediwales.com/this-is-my-pretty-permalink

The following would be my prefered way

Because you dont need the rewrite rule for every page.
The way is to get pretty-permalink running on your old host. Goal is to have the same pretty-permalink on both domains, than u can easily use a 301 redirect and avoid duplicate content.
Put this on your.htaccess on the old domain.

RewriteEngine on
RewriteRule ^(.*) mediwales.com/ [R=301,L]


If you type www.domain.com/this-is-my-pretty-permalink in your browser you will be redirected to mediwales.com/this-is-my-pretty-permalink
Depending on your cms and/or you are using the same page structure, then u dont need the pretty-permalinks on the old host. www.domain.com/index.php?id=3&nid=91 should route to mediwales.com/this-is-my-pretty-permalink
Hope this helps

10% popularity Vote Up Vote Down


 

@Eichhorn148

Use .htaccess to redirect with the following code:

RewriteEngine on
RewriteRule ^([0-9A-Za-z]+)$ /index.php?page= [L]
# 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
Redirect /index.php?id=3&nid=91 mediwales.com/this-is-my-pretty-permalink

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme