Using mod_rewrite how can I change the current URL format:
- From:
https://example.com/something/NAME-IN-CAPS/phonebook.xml
- To:
https://example.com/anything/whatever/phonebook.php?name=NAME-IN-CAPS
Webmasters Stack Exchange is a question and answer site for webmasters. It only takes a minute to sign up.
Sign up to join this communityUsing mod_rewrite how can I change the current URL format:
https://example.com/something/NAME-IN-CAPS/phonebook.xml
https://example.com/anything/whatever/phonebook.php?name=NAME-IN-CAPS
Just take the following example, and rewrite the words something
, anything
, and whatever
to your actual directory names:
RewriteRule something/([-A-Z]+)/phonebook.xml anything/whatever/phonebook.php?name=$1