Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Php url redirection

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
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
Close
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
Close
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
Close
i am getting an internal server error 500
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back