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 does session work in php?
What is super keyword in c++?
What is $_ get?
Tell me can the value of a constant change during the script's execution?
How can we check the value of a given variable is a number?
Can we use php variable in javascript?
How many escape sequences are recognized in double-quoted strings in php?
Does PHP 5 support exceptions? State Whether True or False?
Is php strongly typed?
What are the advantages of indexes in php?
Explain about require and include function?
How to return a value back to the function caller?
How do I check if a given variable is empty?
What is == and === in php?
What is the method to register a variable into a session?