Php url redirection

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

asgsoft

VIP Member
Impact
9
How can I redirect all the hits from seotools.php to mysite.com/seo-tools/ when the folder doesn't exist?

I know it can be done , .htaccess but how?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Not sure about the .htaccess, but as the title says "php url redirection", here is the php code:

PHP:
<?php header('Location: /path/to/your/file.php'); ?>
 
0
•••
That's jsut the PHP version of a Meta Refresh. This is what you're after I believe. Make a file called .htaccess nothing else and put this in:

RewriteEngine on
RewriteRule ^(.*)/ /$1.php [nc]
 
0
•••
DJL2K said:
That's jsut the PHP version of a Meta Refresh. This is what you're after I believe. Make a file called .htaccess nothing else and put this in:

RewriteEngine on
RewriteRule ^(.*)/ /$1.php [nc]

where does it mention seo-tools and seotools.php?
 
0
•••
The (.*) matches anything.
Code:
RewriteEngine on
RewriteRule ^seo-tools/? seotools.php [NC]
This code does what his does but is more specific. Also, his will probably cause errors due to not being setup how your files and links are set up.

My code makes it so that if someone goes to http://your-site.com/seo-tools it will actually load http://your-site.com/seotools.php
 
0
•••
i am getting an internal server error 500
 
0
•••
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back