Php url redirection

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
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back