Abhi
Abhi

Reputation: 1115

How to redirect URL in wordpress

I created my website using PHP before so that all the page urls extensions are ended up with php extension like www.example.com/about-us.php and I shared that urls in some other places.

But now I am creating that site in wordpress so all the urls are like www.example.com/about-us

Now how can I redirect www.example.com/about-us.php to www.example.com/about-us

Upvotes: 1

Views: 195

Answers (2)

anubhava
anubhava

Reputation: 784878

You can place this rule just below RewriteBase line in WP's .htaccess file to redirect .php links:

RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.php[\s?] [NC]
RewriteRule !(^|/)wp-login\.php$ /%1 [R=301,L,NC,NE]

Upvotes: 1

GautamD31
GautamD31

Reputation: 28763

You can also do like,goto admin panel and click on permalinks under settings.Then you notice options for Url settings.As per your need you need to select Post name and then your all URLs will like as your deserve(www.example.com/about-us)

Upvotes: 1

Related Questions