Results 1 to 6 of 6

 

Thread: php redirects

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    9
    Thanked 1 Time in 1 Post


    Hiya iv got a quick question on php redirects - If i have a website which is reading blah-blah.php and im moving the website to WP but WordPress doesn't end any files in .php even though they are php. Iv been told to put a redirect on there, to make sure you i don't drop any links will this get me penalized from google? Thanks

    Katy

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Mar 2004
    Location
    Stafford, UK
    Posts
    322
    Thanks
    1
    Thanked 4 Times in 2 Posts
    Hi Katy,

    There's no reason why you can't use .php as part of a custom permalink structure in WordPress. The settings for how WordPress generates clean URLs are in wp-admin > Settings > Permalinks, so you choose Custom Structure and enter:

    Code:
    /%postname%.php
    With that in place, if you create a post named Blah Blah it will take on the permalink /blah-blah.php (permalinks are lower cased and hyphenated) so if that matches your existing site page URLs and you're happy keeping .php in the URL that should be all you need to do.

    A redirect on the other hand should be straight forward to add provided that there is a direct mapping between your old .php page names and the permalink structure being used on your WordPress site. Let's say your site is set-up to permalink to just:

    Code:
    /blah-blah
    When permalinks are enabled, you'll find a file called .htaccess in the top level folder, and in that file you'll find this line (assuming WordPress is installed in the top level)

    Code:
    RewriteBase /
    To add the redirect as you've been advised to do, you could add the following immediately after the above line:

    Code:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*).php$ $1 [L,R=301]
    Or in English.. if the file requested doesn't already exist; then take the part in-front of .php and issue a 301 "Moved Permanently" redirect to same URL but without .php on the end...

    Hope this helps!

    Developer of the Price Tapestry Price Comparison Script now with full WordPress Plugin!

  3. The Following 2 Users Say Thank You to dmorison For This Useful Post:

    dc000000 (02-02-12), katy111 (02-02-12)

  4. #3
    Registered User

    Status
    Offline
    Join Date
    Feb 2010
    Posts
    1,392
    Thanks
    62
    Thanked 142 Times in 131 Posts
    He's good isn't he

    On the seo apsect I don't think it's an issue because it's not another file type - just that it is being re-written to look nice (so is already redirecting).

    Some more info here also:

    Does removing the .php / .html extension on your pages effect SEO ?

  5. The Following User Says Thank You to dc000000 For This Useful Post:

    katy111 (02-02-12)

  6. #4
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    1,351
    Thanks
    43
    Thanked 72 Times in 63 Posts
    Quote Originally Posted by dc000000 View Post
    He's good isn't he

    On the seo apsect I don't think it's an issue because it's not another file type - just that it is being re-written to look nice (so is already redirecting).

    Some more info here also:

    Does removing the .php / .html extension on your pages effect SEO ?
    now if only someone like dmorison created a replacement for affmeter , you would know that you had constant great support and it would actually work

  7. #5
    Registered User

    Status
    Offline
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    9
    Thanked 1 Time in 1 Post
    Hey, thanks everyone for getting back, going to try and get my head around all of that lol but if i get a bit stuck would you mind if i PM you dmorison?

    Katy

  8. #6
    Registered User

    Status
    Offline
    Join Date
    Mar 2004
    Location
    Stafford, UK
    Posts
    322
    Thanks
    1
    Thanked 4 Times in 2 Posts
    Quote Originally Posted by katy111 View Post
    Hey, thanks everyone for getting back, going to try and get my head around all of that lol but if i get a bit stuck would you mind if i PM you dmorison?

    Katy
    No probs..!



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2