-2

I am currently working on a signup page and I was wondering if I could modify the URL without the .php extension.

For example, it is now

www.xyz.com/signup.php

And what I would like achieve is

www.xyz.com/signup

Now I am assuming that I might have to use the htaccess file, but I am not sure about it.

Prix
  • 19,417
  • 15
  • 73
  • 132
rahulrajj
  • 11
  • 1
  • possible duplicate of [remove .php extension with .htaccess](http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess) – Bora Aug 28 '13 at 08:30

3 Answers3

1

First rule will redirect from signup.php to domain.com/signup/.

Second rule will redirect internally so the URL will remain domain.com/signup/ while displaying the content of domain.com/signup.php.

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

# Redirect /signup.php to /signup/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+signup\.php\s [NC]
RewriteRule ^ /signup/? [R=302,L]

# Internally forward /signup/ to /signup.php
RewriteRule ^signup/?$ /signup.php [NC,L]
Prix
  • 19,417
  • 15
  • 73
  • 132
0

What you're looking for is called URL rewrite. Take a look at this tutorial for beginners: http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/.

Luka
  • 1,718
  • 3
  • 19
  • 29
0

You can duplicate with .htaccess

RewriteEngine On

RewriteRule singup$ singup.php [NC,L]
Noel
  • 10,152
  • 30
  • 45
  • 67