Forum

Thread tagged as: Question, Problem, Runway

Clean URLs .htaccess HELP

Hi there,

Was hoping if anyone could help me here. I have just launched a new Perch site from Perch to Perch Runway.

The original blog was set up like this

domain.com/post.php?s=2016-04-19-post-title

So now for the new blog on Perch Runway the set up is the following

domain.com/news/2016-04-19-post-title

My .htaccess is following (please ignore all the 301 redirects)

<IfModule mod_rewrite.c>
    RewriteEngine On
    # Remove www. from subdomains

    RewriteCond %{HTTP_HOST} ^www\.extract-technology\.com$ [NC]
    RewriteRule ^(.*)$ https://extract-technology.com/$1 [R=301,L]
</IfModule>

RewriteRule ^news/([a-zA-Z0-9-/]+)$ /post.php?s=$1 [L]

Redirect 301 /about/containment-systems/downflow-booths https://extract-technology.com/products/containment-solutions/downflow-booths
Redirect 301 /who-we-are/ https://extract-technology.com/about/
Redirect 301 /what-we-do/containment-systems/ https://extract-technology.com/products/containment-solutions/
Redirect 301 /careers https://extract-technology.com/contact/careers/
Redirect 301 /what-we-do/aseptic-systems/ https://extract-technology.com/products/aseptic-solutions/
Redirect 301 /about/meet-the-team/alan-wainwright https://extract-technology.com/about/meet-the-team/
Redirect 301 /what-we-do/containment-strategy https://extract-technology.com/services/containment-strategy/
Redirect 301 /about/meet-the-team/paul-hudson https://extract-technology.com/about/meet-the-team/
Redirect 301 /downloads https://extract-technology.com/
Redirect 301 /what-we-do/containment-systems/high-containment-screen https://extract-technology.com/products/containment-solutions/
Redirect 301 /what-we-do/aseptic-systems/ https://extract-technology.com/products/aseptic-solutions/
Redirect 301 /what-we-do/standard-systems/ https://extract-technology.com/products/standard-solutions/
Redirect 301 /videos https://extract-technology.com/news/category/videos
Redirect 301 /about/meet-the-team/jason-armitage https://extract-technology.com/about/meet-the-team/
Redirect 301 /where-we-work/ https://extract-technology.com/contact/global-reach/
Redirect 301 /where-we-work/asia https://extract-technology.com/contact/global-reach/asia/
Redirect 301 /where-we-work/australia https://extract-technology.com/contact/global-reach/australasia/
Redirect 301 /where-we-work/russia https://extract-technology.com/contact/global-reach/russia/
Redirect 301 /where-we-work/europe https://extract-technology.com/contact/global-reach/
Redirect 301 /where-we-work/middle-east https://extract-technology.com/contact/global-reach/middle-east/
Redirect 301 /where-we-work/africa https://extract-technology.com/contact/global-reach/africa/
Redirect 301 /where-we-work/south-america https://extract-technology.com/contact/global-reach/south-america/
Redirect 301 /where-we-work/central-america https://extract-technology.com/contact/global-reach/central-america/
Redirect 301 /where-we-work/north-america https://extract-technology.com/contact/global-reach/north-america/
Redirect 301 /contact/global-reach/international-approach https://extract-technology.com/contact/global-reach/
Redirect 301 /contact/global-reach/offices https://extract-technology.com/contact/contact-us/
Redirect 301 /news.php https://extract-technology.com/news/
Redirect 301 /about/news/ https://extract-technology.com/news/
Redirect 301 /what-we-do/after-market/ https://extract-technology.com/services/relocations-upgrades/
Redirect 301 /what-we-do/ https://extract-technology.com/services/
Redirect 301 /firm-extracts-best-using-technology https://extract-technology.com/products/
Redirect 301 /about/key-facts-figures https://extract-technology.com/about/history/
Redirect 301 /clients https://extract-technology.com/about/clients/
Redirect 301 /about/core-values https://extract-technology.com/about/vision/
Redirect 301 /services/facilities https://extract-technology.com/products/containment-solutions/facilities
Redirect 301 /newsletters https://extract-technology.com/
Redirect 301 /about/reputation https://extract-technology.com/about/clients/
Redirect 301 /contact/global-reach/australia https://extract-technology.com/contact/global-reach/australasia/
Redirect 301 /about/mission https://extract-technology.com/about/
Redirect 301 /archive.php https://extract-technology.com/news/archive/
Redirect 301 /contact/global-reach/europe https://extract-technology.com/contact/global-reach/
Redirect 301 /services/relocations-upgrades/spare-parts https://extract-technology.com/products/spare-parts/
Redirect 301 /about/welcome-message https://extract-technology.com/about/
Redirect 301 /turn-key-finishing-area-facility https://extract-technology.com/products/
Redirect 301 /what-we-do/after-market/servicing https://extract-technology.com/services/relocations-upgrades/
Redirect 301 /pl/standard-containment-isolator https://extract-technology.com/pl/standardowy-izolator-sterylny/
Redirect 301 /fr/standard-containment-isolator https://extract-technology.com/fr/isolateur-de-confinement-standard/
Redirect 301 /pl/mobile-automated-glove-tester https://extract-technology.com/pl/zautomatyzowany-mobilny-tester-rekawic/
Redirect 301 /pl/standard-aseptic-isolator https://extract-technology.com/pl/standardowy-izolator-ograniczajacy-rozprzestrzenianie/
Redirect 301 /es/standard-containment-isolator https://extract-technology.com/es/aislador-de-contencin-estndar/
Redirect 301 /containment-systems https://extract-technology.com/products/containment-solutions/
Redirect 301 /containment_isolators.php https://extract-technology.com/products/containment-solutions/containment-isolators
Redirect 301 /what-we-do https://extract-technology.com/services/
Redirect 301 /products/containment-solutions/downflow-booths.php https://extract-technology.com/products/containment-solutions/downflow-booths
Redirect 301 /news/2014-05-23-active-restricted-access-barrier-system-for-autoclave-unloading-+-can-filling https://extract-technology.com/news/2014-05-23-active-restricted-access-barrier-system-for-autoclave-unloading-can-filling
Redirect 301 /contact-us https://extract-technology.com/contact/contact-us/

# Perch Runway
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /admin/core/runway/start.php [L]

Anyone every faced this issue? I have tried the rule RewriteRule ^news/([a-zA-Z0-9-/]+)$ /post.php?s=$1 [L] as you can see above but it didnt work for me.

Thanks

Fishtank Creative

Fishtank Creative 2 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If I've understood correctly, you have your rule backwards. You want to match any post.php URL and redirect it to the new, clean version, right?

So something like:

RewriteCond %{QUERY_STRING} s=([\w-]+)
RewriteRule ^post.php /news/%1? [L,R=301]

That's a rough guess based on the query string info found here: https://stackoverflow.com/questions/2252238/how-can-i-match-query-string-variables-with-mod-rewrite

Thanks this has worked :-)