1

I already found several topics and questions regarding this, but it seems everything I'm trying to do doesn't do what it is supposed to do:

.htaccess-file

Options +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?site=$1 

As you can tell, nothing to special. This example was taken from this solution here: SEO Friendly URL (with .htaccess)

From my example:

http://example.org/index.php?site=delivery

should result in

http://example.org/Delivery # If it is possible, a capitalized Letter would be cool

I can call the Site manually, but references (to *.css-files) aren't included anymore. Furthermore, the RewriteBase doesn't seem to work.

I added some buggy code to verify that the .htaccess file is loaded (and it is).

If I linke something with <a href="index.php?site=mySite"> - does the URL automagically change to the specific rule? Yes, right? But what could be missing, that the rules aren't applying?

Thank you in advance

Community
  • 1
  • 1
DasSaffe
  • 2,080
  • 1
  • 28
  • 67
  • Read: http://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained – Croises Nov 11 '15 at 15:26

1 Answers1

2

Your rule is fine. Because of the rewrite, you have to handle relative links differently now.

So once the rule is in place. You need to add this to the <head> section of your html.

<base href="http://www.yoursite.com" />

Then your JS and CSS will load while using the rule. It's not a .htaccess rule problem.

If I linke something with - does the URL automagically change to the specific rule?

No it does not. You need a rule for that too.

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond {THE_REQUEST} ^[A-Z]{3,}\ /+index\.php\?site=(.+)
RewriteRule ^ %1? [R=301,L]

RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?site=$1 
Panama Jack
  • 24,158
  • 10
  • 63
  • 95