By tdellaringa on
I initially thought this problem was favicon related (boy is my face red). Anyway, I'm trying to redirect old urls from our old site like
<IfModule mod_rewrite.c>
RewriteEngine on
# CUSTOM: rewrite old urls to new clean urls
RewriteRule ^[0-9]{4}/[0-9]{2}/[0-9]{2}/(.+?)/?$ /articles/$1/ [R=301,L]
# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
The rule I added (next to # CUSTOM) is what broke the site. Any idea why this would suddenly make drupal not see the css? Is there a way to keep it from executing the rule on css files? It's a shame because the rules works, and I have a lot of urls this fixes which we need to be fixed...any help is appreciated.
Comments
You might want to put a
You might want to put a condition rule above it... Something to make it skip the rule in case of .css extentions, maybe?
Try testing this:
RewriteCond %{REQUEST_URI} ^[0-9]{4}/[0-9]{2}/[0-9]{2}/(.+?)/?$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.css.*$ [NC]
RewriteRule . /articles/$1/ [R=301,L]
Well, that seems to fix the
Well, that seems to fix the CSS issue, but now the rewrites are not working :/
Here is the whole htaccess as it stands now
Are you running Drupal in a subdirectory?
Are you running Drupal in a subdirectory (example.com/mysite/)? If so you might want to try adding a rewrite base:
------------------------------------
Gorton Studios - Websites that Work. http://www.gortonstudios.com/
http://www.gortonstudios.com/portfolio/technologies/drupal
------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/
also...
Rewrite Conditions only apply to the rule that immediately follows them, so you might want to change your rewrite rules to:
or
or even
See if any of those work. Sometimes getting rewrite rules right is a matter of trial and error.
------------------------------------
Gorton Studios - Websites that Work. http://www.gortonstudios.com/
http://www.gortonstudios.com/portfolio/technologies/drupal
------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/
The middle one seemed to
The middle one seemed to work, until I realized my most important most hit article link was broken, all I get now is my articles page. So I removed the rewrites, reverted back to the default .htaccess I had, and it still doesn't work. Our most hit link was
2006/07/28/10-claims-in-the-bible-on-the-deity-of-christ/
which needed to be changed to
articles/10-claims-in-the-bible-on-the-deity-of-christ/
But now, all I get is the articles page - even after I deleted and re-created the article entirely with a different URL ... so this link
http://www.crossandthrone.com/articles/ten-claims-in-the-bible-on-the-de...
(changed 10 to ten) does not give me the actual article, but instead the same content you would see on
http://www.crossandthrone.com/articles
This is crazy. I turned off caching. I don't know why that link won't work. Now I wish I had never even tried this, at least with the 404 page I can let people know things have changed, now they just get a page that makes no sense to them at all.
That's strange, but I don't
That's strange, but I don't think it's related to the url rewriting.
Go to the path alias admin page and make sure there is only one alias with that url, then remove the '/' from the end of the alias and see if that helps
R
------------------------------------
Gorton Studios - Websites that Work. http://www.gortonstudios.com/
http://www.gortonstudios.com/portfolio/technologies/drupal
------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/
Yep, you were correct,
Yep, you were correct, somehow I must have had duplicates - I noticed a couple other dupes in there - so you can only have one alias for each node? For example, if I have this node:
node/95
I can only have one url alias, or I will have problems?
Thanks again, I will try the other rewrite rules again.