RomaValcer
RomaValcer

Reputation: 2966

Configuring mod_rewrite issue

I have in my htaccess the following:

DirectoryIndex index.py
RewriteEngine On
RewriteBase /
RewriteRule ^([0-9]+)$ index.py?id=$1 [L]
RewriteCond %{THE_REQUEST} /index\.py [NC]
RewriteRule ^(.*?)index\.py$ /$1 [L,R=302,NC,NE]

First rule sends someone looking for

mydomain.com/<digits>

to mydomain.com/index.php?id=, second rule fixes hrefs inside index.py. But when I add

RewriteBase /
RewriteRule ^([^0-9]+)$ index.py [L]

To make anyone whose request is not only digits go to index.py, divs in index.py just kinda disappear. What is the problem?

Upvotes: 1

Views: 22

Answers (1)

Jon Lin
Jon Lin

Reputation: 143946

Probably because you're rewriting everything to index.py, including your style sheets or scripts or whatever. Try changing the rule to:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^0-9]+)$ index.py [L]

Upvotes: 1

Related Questions