How we can convert dynamic url into static url? plz provide
code.
Answer Posted / udit rawat
Add an .htaccess file(if using apache)
# Turn on URL rewriting
RewriteEngine On
RewriteBase /
# Allow any files or directories that exist to be displayed
directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]
This redirects all urls to index.php. index.php will be some
sort of front controller that loads scripts based on the url
So in your example:
localhost/mywebsite/mypage
Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
Where do I run php code?
What is csrf token in php?
What is difference between array_merge and array_combine in php?
How to copy a file?
What is the difference between static and dynamic websites?
What is php beginner?
What is php destruct?
What is difference between get and post in php?
What is php constructor?
Do you know what's the difference between __sleep and __wakeup?
What are some new features introduced in php7?
What is the use of the function htmlentities?
How we can declare variable in php?
Is nan in php?
How variables are passed through arguments?