NameSilo

Php url redirection

Namecheap AuctionsNamecheap Auctions
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
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
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back