I would love to change the link to my website to complete SEO urls.
The component i’m working ons works with the next link
siterurl.ext/readarticle/?article=10486
I need to change it to
siterurl.ext/readarticle/article/10486
How can I do this with htaccess?
The basic friendly urls is working.
-
☆ A M B ☆
- 2,213 Posts
You would use something like this:
RewriteRule ^readarticle/article/([^_]*)$ /index.php?q=readarticle/?article=$1 [L]
Keep in mind this is untested! It goes just before this htaccess:
RewriteRule ^(manager|assets) - [L]
# For Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
I don’t have that manager/asset rule
But if I create this (with or without the manager) all the pages are loading without css style
Also the readarticle/article/xxxxx is not working and going to the homepage.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^readarticle/article/([^_]*)$ /index.php?q=readarticle/?article=$1 [L]
RewriteRule ^(manager|assets) - [L]
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
I would try to create a plugin for onPageNotFound.
example see in this thread:
http://modxcms.com/forums/index.php/topic,60689.msg345196.html#msg345196
-
☆ A M B ☆
- 2,213 Posts
It looks like you have things out of order, you are looking for something like this:
RewriteRule ^readarticle/article/([^_]*)$ /index.php?q=readarticle/?article=$1 [L]
# For Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
Look for the comment "# For Friendly URLs" in your htaccess code and place my line directly above it. I can take a closer look if you are still having issues.