0

I have a very basic website that uses an .htaccess file. The website itself is just static PHP pages, such like www.domain.com/about.php.

I'm struggling to work out how I can use .htaccess to change the URL to www.domain.com/about-something-seo-friendly/.

Currently I've attempted;

RewriteCond %{THE_REQUEST} ^(GET|HEAD|POST)\ /(.*)\.php($|\ )
RewriteCond %{REQUEST_URI} !wp-admin
RewriteRule ^ /%2/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/(.*?)/?$
RewriteCond %{DOCUMENT_ROOT}/%1.php -f
RewriteRule ^ /%1.php [L]

This simply uses the part before the .php for the name, which isn't entirely what I want, but for testing purposes. Although this works, the page then renders with 0 graphics, just plain text.

What am I missing?

PnP
  • 2,921
  • 15
  • 54
  • 88
  • Have you already changed the URL in your application? The problem here is the `-something-seo-friendly` part... if you are _changing_ the URL structure then how do we map `about.php` to `about-something-seo-friendly`? If preserving existing SEO is not a concern then that isn't an issue. – MrWhite Jan 05 '19 at 15:55
  • Quite honestly this is all new to me, I'm not entirely sure what you mean. – PnP Jan 05 '19 at 15:59
  • Possible duplicate of [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](https://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – MrWhite Feb 03 '19 at 14:59

0 Answers0