News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

.htaccess wierdness

Started by Krashsite, September 22, 2016, 01:18:23 AM

Previous topic - Next topic

Sir Osis of Liver

Tinkering with some .htaccess redirects for two forums in same domain, couldn't get one of them to work right.  Here's the code -



RewriteEngine On
RewriteRule ^$ /forum [L]
Redirect /oldsubdir/ http://www.domain.com/newsubdir/smf
Redirect /oldsubdir http://www.domain.com/newsubdir/smf



First one redirects domain to /forum subdirectory, works fine.
Second one (different forum) redirects old forum subdirectory to new subdir, also works fine.
Third one is same as second, except it redirects oldsubdir without trailing slash.  This has been giving me grief.

After for over an hour without success, went back to it as I'm writing this, and all three are working fine in IE11 and FF37.  Problem seems to have cleared itself up somehow, but something wasn't right.  Two questions -

1. - Is the code correct for what I'm trying to do?
2. - Is .htaccess cached anywhere?  I have caching disabled on all forums, and disabled server caching.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Glyph

Personal TODO:

Arantor

RewriteEngine On
RewriteRule ^$ /forum [L]
Redirect /oldsubdir(.*) http://www.domain.com/newsubdir/smf


maybe?

(Don't have something suitable I can test with right now)

Sir Osis of Liver

Tried something like that last night, didn't work.  All of the redirects as posted above are working today.  Found a stray file in my account root last night (home.html) which contained a small scrap of what looked like php code.  Appeared to be harmless, just caused root redirect to fail and display the code on blank page, unless there was something else in the file that didn't show in text editor.  Have asked  host to run security scan on the account.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

richardwbb

Maybe this is helpful [though I don't understand in full what you are trying to accomplish]

Redirect 301 /oldsubdir http://www.domain.com/newsubdir/smf

I also rewrote my htaccess, the order of the rules you setup have to be reviewed with every change.
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

Advertisement: