Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End [Solved] .htaccess mod_rewrite Re: [Solved] .htaccess mod_rewrite

#71540
copperSmith
Member

Seems, this thing is lopping off the extension as well as in most cases here not redirecting to the proper directory… that said, I understand what you meant about ignoring the 404s. The below are the results from using these three samples in the trinityportland.org/ as opposed to the trinityportland.org/our-school/ folder. When I used the /our-school/ folder… no redirection occurred – just 404s from borked links.

this one is changing this url: http://trinityportland.org/about/index.shtml
to this url: http://trinityportland.org/our-school/about/about/index

with the following error report:
The requested URL /our-school/about/about/index was not found on this server.

Code:
# BEGIN DIRECTORY REDIRECTION
RewriteEngine on
RewriteBase /about/
RedirectMatch 301 (.*).shtml http://trinityportland.org/our-school/about$1
# END DIRECTORY REDIRECTION

this one is changing this url: http://trinityportland.org/about/index.shtml
to this url: http://trinityportland.org/our-school/a … bout/index

With the following error report:
The requested URL /our-school/about//about/index was not found on this server.
Additionally, a 301 Moved Permanently error was encountered while trying to use an ErrorDocument to handle the request.

removing the portion in red: RedirectMatch 301 /(.*).shtml http://trinityportland.org/our-school/about/$1

got me this error report: The requested URL /our-school/about/index was not found on this server.

** If I could stop this thing from nixing the extension, I think this may be the solution. **

Code:
# BEGIN DIRECTORY REDIRECTION
RewriteEngine on
RewriteBase /about/
RedirectMatch 301 /(.*).shtml http://trinityportland.org/our-school/about/$1
# END DIRECTORY REDIRECTION

this one is changing this url: http://trinityportland.org/about/index.shtml
to this url: http://trinityportland.org/our-school/a … ut/history

With the following error report:
The requested URL /our-school/about/about/history was not found on this server.

Code:
# BEGIN DIRECTORY REDIRECTION
RewriteEngine on
RewriteBase /about/
RedirectMatch 301 ^(.*).shtml http://trinityportland.org/our-school/about$1
# END DIRECTORY REDIRECTION