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 sessions stored in PHP?
How to connect to mysql from a php script?
How to get length of an array in PHP?
What is the ioncube php loader?
How do you use end in python?
What is compact function php?
Which functions are used to remove whitespaces from the string?
Which functions are used to count the total number of array elements in php?
How to access a global variable inside a function?
What does isset() function?
Why namespace is used in php?
How to increase the execution time of a PHP script?
What do you mean range() in php?
How to read one character from a file?
How can we determine whether a php variable is an instantiated object of a certain class?