Changing WordPress URL structure while maintaing the proper 301 redirects with mod_rewrite

Question!

I currently have a blog set up with WordPress using URLs like so:

www.domain.com/blog/?pid=384092817

This was before I knew anything about anything. There's a significant amount of content there now and I want to change my URL structure to:

www.domain.com/my-post-title-384092817

Is there a way to set up my .htaccess and mod rewrite so when users go to the first url they get a 301 redirect to the second URL? I know to change my WordPress address (URL) setting from www.domain.com/blog to www.domain.com and my permalink setting to /%postname%-%post_id%, but how do I tell the old URLs to redirect to the new ones?



Answers

Depending on your WP version, you can just use the Permalink redirect plugin -- should do the trick for you within WordPress and without mod_rewrite. However, as of WordPress 2.3, a lot of this should work automatically. At that point, the only thing you should have to do is redirect all your /blog/... requests to the route, which you can do via mod_rewrite roughly like this:

RewriteRule ^blog(.*) $1 [QSA]
By : Fortes


You can set label as an attribute of field when you define form.

class GiftCardForm(forms.ModelForm):
    card_name = forms.CharField(max_length=100, label="Cardholder Name")
    card_number = forms.CharField(max_length=50, label="Card Number")
    card_code = forms.CharField(max_length=20, label="Security Code")
    card_expirate_time = forms.CharField(max_length=100, label="Expiration (MM/YYYY)")

    class Meta:
        model = models.GiftCard
        exclude = ('price', )
By : kiennt


It don't work for model inheritance, but you can set the label directly in the model

email = models.EmailField("E-Mail Address")
email_confirmation = models.EmailField("Please repeat")
By : Bender-51


This video can help you solving your question :)
By: admin