1

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
4
  • Out of interest why would you want to add the string? most people want to remove it for user experience and SEO. Commented Nov 10, 2015 at 12:07
  • I want to get the phonebook via the php script, i put the name of the user i want to fetch, but the phone is always trailing any url as /phonebook.xml and thats why I need something like this. Commented Nov 10, 2015 at 12:11
  • Does the "current URL format" actually return a valid resource? Commented Nov 10, 2015 at 14:53
  • No, it does not. Commented Nov 10, 2015 at 15:35

1 Answer 1

1

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
1
  • Thanks, that is what i was looking for, i modified a little bit the regex, but its fine. Thanks. Commented Nov 10, 2015 at 15:34

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.