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
How to get the number of characters in a string?
What is overloading and overriding in php?
What do you mean by having php as whitespace insensitive?
What are php variables?
Is array a key php?
Do you know how can php and html interact?
How can you declare a constant variable in php?
What is difference between action hook and filter hook?
What is the use of $_server and $_env?
Why do we use cookie?
What is needed to be able to use image function?
Can we use session in mvc?
Is nan in php?
What is php in full?
What is filter_var?