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
What is basic php?
How do you clear environment variables?
How is the ternary conditional operator used in php?
How can a cross-site scripting attack be prevented by php?
What is composer used for?
What are the advantages and disadvantages of cascade style sheets?
What does $_env means?
What is the difference server side and browser side validation?
How to select a database in php?
What is the difference between php 5 and php 7?
How to find the position of the first occurrence of a substring in a string?
What is the use of mvc in php?
What is the use of hooks?
What is move_uploaded_file in php?
What is php and sql?