Here is the result i wanna to achieve:
to
Here is the code from .htaccess file that i tried to use:
RewriteRule ^fb$ fb.php [L]
I would really appreciate if someone taking their time to help me with this question. Many thanks!
Here is the result i wanna to achieve:
to
Here is the code from .htaccess file that i tried to use:
RewriteRule ^fb$ fb.php [L]
I would really appreciate if someone taking their time to help me with this question. Many thanks!
There's no such thing as PHP rewrite. If you want to remove the .php file extension, that can be done.
It's .htaccess rewrite, you could try using this on your .htaccess:
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L, QSA]
Also, make sure that you've mod_rewrite on.
First step to do that, is open an SSH connection to your server, login with root and type
a2enmod rewrite
It will enable it for you, or tell that if it's already enabled.
And, make sure that file 000-default located at /etc/apache2/sites-enabled has
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
instead of
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
If you want to achieve it for only one url which is http://www.sample.com/fb.php?w=var1&=h=var2
Then use below rewrite rule
RewriteRule ^fb /fb.php [L,QSA]
else if you want for every .php url, Use the above answer by christian
your rewrite rule is fine, just add QSA at the end, to append the query string of the url