Question

I am trying to re-write the URL of one file. I want thankyou.php to show up as /thank-you/. I have gotten this to work only partially.

I have this one rule in my htaccess file:

RewriteEngine On
RewriteRule    ^thank-you/?$    thankyou.php    [NC,L]

I can get this to work for domain.com/thank-you but NOT for domain.com/thank-you/

For some reason the last slash is not working.

Can anyone help me out with this..??

Thank you in advance.

Was it helpful?

Solution

Yes, the relative links are broken.

Your relative links are broken because the browser sees the URL http://example.com/thank-you/, so all relative links will resolve to the base /thank-you/ (e.g. /thank-you/styles/mystyle.css).

Change all your links to absolute URLs or add a relative URI base to the header of your pages:

<base href="/" />

OTHER TIPS

Question mark at the end of your rule says, that this last character is optional. Did you try to use:

RewriteEngine On
RewriteRule ^thank-you\/$ thankyou.php [NC,L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top