In my website people can post videos and pictures. All posts are in this format
domain.com/gag/02938482
How can I change the prefix of a post, instead of gag
to have p
for example.
In my website people can post videos and pictures. All posts are in this format
domain.com/gag/02938482
How can I change the prefix of a post, instead of gag
to have p
for example.
Make sure you have RewriteEngine on
in the .htaccess
file
RewriteEngine on # Turns the rewrite engine on
RewriteRule ^gag/([^/.]+)/?$ view.php?pid=$1 [L]
^
start of the string to rewritegag/
(
start of capturing a variable[
start of a character group^/.
anything not equal to / with any character behind it (.)]
end of a character group+
one or more of the character(group))
end of capturing a variable/?
zero or more slashes$
end of the string to rewriteview.php?pid=
string after rewriting$1
variable 1 (captured with the ()
)[L]
last rule to rewrite